Implementing intersection operator for a set-like class in Python -
i'm trying implement wrapper class should ideally allow me intersection of elements using notation:
a & b
is there specific method can implement achieve this? (i know individual elements need implement __hash__
, __eq__
methods)
i'm getting following error:
typeerror: unsupported operand type(s) &: 'proparray' , 'proparray'
try override:
def __and__(self, *args, **kwargs): # real signature unknown """ return self&value. """ pass
in class
Comments
Post a Comment