I need to overload the operator in and let him
return an object ... It seems it is not a
behavior Python expect :
>>class A:... def __contains__(self,a):
... return 'yop'
...>>a=A()True
print 'toto' in a>>print a.__contains__('toto')yop
Not sure what you're trying to achieve,Using Python as an algebraic parser for
symbolic mathematical equation and I need
that the 'in' operator returns an object based
on its two arguments.
but the semantics of the "in" operatorThat is why I need to overload it.
make it return a boolean value.
The string "yop" evaluates to the booleanDoes it means that when overloading an operator, python just
value True, as it is not empty.
wrap the call to the method and keep control of the returned
values ??? Is there a way to bypass this wrapping ???