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

Stefan Behnel stefan_ml at behnel.de
Sun Oct 31 20:10:37 CET 2010


Georg Brandl, 31.10.2010 18:51:
> 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.
>
> Really?
>
> 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.

Hmm, that reminds me. I think we should reconsider PEP 3117. There's still 
some value in it.

http://www.python.org/dev/peps/pep-3117/

Stefan




More information about the Python-ideas mailing list