[EMAIL PROTECTED] wrote:
> 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()
>>>> print 'toto' in a
> True

Not sure what you're trying to achieve, but the semantics of the "in" operator
make it return a boolean value. The string "yop" evaluates to the boolean
value True, as it is not empty.

Stefan
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to