Proposal: allow '?' and '!' in identifiers

Nathaniel Gray n8gray at
Tue Feb 20 01:21:35 EST 2001

Joshua Marshall wrote:

> David Allen <s2mdalle at> wrote:
> ...
> >> If the addition of '!' as a valid identifier character causes too many
> >> waves, it would still be nice to see '?'.
> > Why?  How would this make the language more expressive?
> > How would it make your programming tasks easier?
> > Is introducing new and strange behavior (such as your
> > a!=b example) worth it?  Why?
> Introducing some strange behavior with '!' may very well not be worth
> it.  However, while adding '?' as a legal identifier character does
> not make the Python more expressive, it can make Python programs more
> self-documenting.  The convention of ending predicate function names
> with '?' is useful, in my opinion.

Hear hear!

(Or should that be "Hear hear?")

IMHO it's not worth adding "!", but if "?" doesn't break anything then it's 
a net gain.  I assert that it _would_ make Python more expressive to add an 
elegant way of indicating that a function returns only boolean values.

Unfortunately, I doubt you'll see much support for deviating from [a-zA-Z_] 
on this newsgroup.  Programmers of languages not descended from C (other 
than Python, of course) are in the minority, even among Pythonistas.  There 
may be some cause for hope, though, because among python-dev subscribers I 
suspect they're in the majority!


             Nathaniel Gray
   California Institute of Technology
     Computation and Neural Systems
     n8gray <at> caltech <dot> edu

More information about the Python-list mailing list