overloading logical not, and, or
johnroth at ameritech.net
Mon Jan 28 13:58:20 CET 2002
"Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com> wrote in message
news:8be7693c.0201280103.65eafd09 at posting.google.com...
> It strikes me as rather odd that Python does not support
> overloading of the logical operators not, and and or.
> Is there a fundamental reason for this, or could a PEP
> help to change this?
If you're talking about the 'and', 'or', and 'not' operators,
as opposed to '&', '!' and so forth, it's because they are
short circuit operators, and Python does not support
lazy evaluation of function arguments.
You could always write a PEP. I have no idea what
Guido would do with it, but I'm not holding my breath.
At a minimum, you'd need to supply some ideas about
syntax for specifying lazy evaluation without breaking
More information about the Python-list