unicode as valid naming symbols

Tim Chase python.list at tim.thechases.com
Tue Mar 25 21:29:41 CET 2014


On 2014-03-25 14:29, Mark H Harris wrote:
>  > It's explained in PEP 3131.
>  >
>  > Basically, a name should to start with a letter (this has been
>  > extended to include Chinese characters, etc) or an underscore.
>  >
>  > λ is a classified as Lowercase_Letter.
>  >
>  > √ is classified as Math_Symbol.  
> 
>     Thanks much!  I'll note that for improvements. Any unicode
> symbol (that is not a number) should be allowed as an identifier.

It's not just about number'ness:

  >>> letter = "a"
  >>> number = "2"
  >>> letter.isidentifier()
  True
  >>> number.isidentifier()
  False
  >>> (letter + number).isidentifier()
  True

-tkc





More information about the Python-list mailing list