Primitive "and" can be overridden? For example, if I try to do something
class foo (): def __ and __ (self, others): return "bar" < P> it becomes output & gt; & Gt; Fu () and 4 4 & gt; & Gt; Fu () .__ and __ (4) 'bar' My intuition is that it has been created and can not be overridden and it is not override due to the absence of confusion should be done.
I think the function should not be changed because it does not need to be done because it behaves like
DIF and (self, others): If not (not bool (self)): Return yourself:
__ and __ override bitvard operator & amp; , not the logic operator. To give your class Boolean logic management, define the __ Nazaroza __ method:
Comments
Post a Comment