Warum kann ich den Operator __and__
nicht neu definieren?neu definieren __and__ operator
class Cut(object):
def __init__(self, cut):
self.cut = cut
def __and__(self, other):
return Cut("(" + self.cut + ") && (" + other.cut + ")")
a = Cut("a>0")
b = Cut("b>0")
c = a and b
print c.cut()
Ich will (a>0) && (b>0)
, aber ich habe b, dass das übliche Verhalten von and
b = cut ("b> 0") sollte – joaquin