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

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -