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

Popular posts from this blog

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -