[Python-ideas] Accepting "?" as a valid character for identifiers

Georg Brandl g.brandl at gmx.net
Sun Oct 31 18:51:53 CET 2010

Am 31.10.2010 16:55, schrieb Andre Roberge:
> In some languages (e.g. Scheme, Ruby, etc.), the question mark character (?) is
> a valid character for identifiers.  I find that using it well can improve
> readability of programs written in those languages. 
> Python 3 now allow all kinds of unicode characters in source code for
> identifiers. This is fantastic when one wants to teach programming to
> non-English speakers and have them use meaningful identifiers.
> While Python 3 does not allow ?, it does allow characters like ʔ 
> (http://en.wikipedia.org/wiki/Glottal_stop_%28letter%29)  which can be used to
> good effect in writing valid identifiers such as functions that return either
> True or False, etc., thus improving (imo) readability.


if number.even?():
    # do something

Since in Python, function/method calls require parens -- as opposed to Ruby,
and in Scheme the parens are somewhere else, this doesn't strike me as more
readable, on the contrary, it looks more noisy.  Same goes for mutating
methods with "!" suffix -- it looks just awkward followed by parens.

(Obvious objection: use a property. Obvious answer: pick a method with args.)

Another drawback of introducing such a convention this late in the design of
the language is that you can never have it applied consistently.  Changing
the builtin and stdlib instances alone would need hundreds of compatibility


Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

More information about the Python-ideas mailing list