"Fredrik Bertilsson" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I am trying to overload the "and" operatior, but my __and__ method is
> never called.

That is because, properly speaking, 'and' and 'or' are, in Python, in-line 
flow-control keywords (related to 'if' and 'else'),  and not operators. 
Operators are abbreviated function calls.  For binary operators, this means 
evaluating both left and right operands and then calling the function, 
which may hook into a special method, as you tried to do.  'And' and 'or', 
on the other hand, try to avoid evaluating the right expression.

Terry J. Reedy




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

Reply via email to