提交 73daa003 authored 作者: Tanjay94's avatar Tanjay94

Added a check that doesn't add the '{}' part when __props__ is an empty tuple in __str__.

上级 61794531
...@@ -586,6 +586,9 @@ class Op(utils.object2, PureOp, CLinkerOp): ...@@ -586,6 +586,9 @@ class Op(utils.object2, PureOp, CLinkerOp):
def __str__(self): def __str__(self):
if hasattr(self, '__props__'): if hasattr(self, '__props__'):
if len(self.__props__) == 0:
return "%s" % (self.__class__.__name__, ", ".join("%s=%r"))
else:
return "%s{%s}" % (self.__class__.__name__, ", ".join("%s=%r" % (p, getattr(self, p)) for p in self.__props__)) return "%s{%s}" % (self.__class__.__name__, ", ".join("%s=%r" % (p, getattr(self, p)) for p in self.__props__))
else: else:
return super(Op, self).__str__() return super(Op, self).__str__()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论