¿Por qué no puedo redefinir el operador __and__
?redefinir operador __and__
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()
Quiero (a>0) && (b>0)
, pero tengo b, que el comportamiento habitual de and
b = corte ("b> 0") se deben cortar (en mayúsculas) – joaquin