[Python-3000] Wither PEP 335 (Overloadable Boolean Operators)?

Raymond Hettinger python at rcn.com
Sat May 19 23:37:23 CEST 2007

> Giovanni Bajo wrote:
>> Another workaround could be:

Before focusing mental talents on workarounds and implementations,
it would be worthwhile to consider whether the idea would help or
hurt the language.  The and/or keywords already have some complexity
due to their returning non-boolean values.  IMO, it would be a disservice
to the language to further complexify their meanings.  Right now, at least, 
we can make a static reading of the code and have a good idea of what 
the and/or keywords mean.

Someone once proposed overloadable behavior for the "is" operator.
IMO, the reasons for rejecting that idea also apply to this proposal.

FWIW, the peephole optimizer takes advantage of the current meaning
of and/or to generate faster code.  It would be ashamed to lose this
optimization and have all applications pay a price in slower code.


More information about the Python-3000 mailing list