Question mark in variable and function names

Andrew Dalke adalke at mindspring.com
Wed Oct 6 13:48:26 EDT 2004


Alex Martelli:
 >  As this would cause no
> backwards incompatibility, it could even be introduced in Python 2.5,

   or!=0

is currently valid.  Changing the tokenizer to allow
trailing ? and ! would turn this into an assignment to
"or!".  A quick grep finds these two places in the standard
lib that would become a syntax error

robotparser.py:    if a!=b:


threading.py:  self._note("%s.notify(): notifying %d waiter%s", self, n,
threading.py:              n!=1 and "s" or "")

Had we added C's "?:" ternary operator we likely would have
had similar small problems there.  Good thing we didn't do that.  :)

				Andrew
				dalke at dalkescientific.com



More information about the Python-list mailing list