def __add__(self, other):
if not isinstance(other, Node):
other = Node(data=other)
if other.type == 'val':
if other.value in (0, Color((0,0,0)), Vector((0,0,0))):
return self # useless addition if other is zero
if self.type == 'val':
if self.value in (0, Color((0,0,0)), Vector((0,0,0))):
return other # useless addition if other is zero
return Node('ADD', inputs=(self, other))
评论列表
文章目录