unicode as valid naming symbols

Antoon Pardon antoon.pardon at rece.vub.ac.be
Wed Mar 26 09:52:25 CET 2014

On 26-03-14 03:56, MRAB wrote:
> On 2014-03-25 22:47, Ethan Furman wrote:
>> On 03/25/2014 12:29 PM, Mark H Harris wrote:
>>> On 3/25/14 2:24 PM, MRAB 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.
>> No, it shouldn't.  Doing so would mean we could not use √ as the
>> square root operator in the future.
> Or as a root operator, e.g. 3 √ x (the cube root of x).
Personally I would think such an operator is too limited to include in a programming language.
This kind of notation is only used with a constant to indicate what kind of root is taken and
only with positive integers. Something like the equivallent of the following I have never seen.

  t = 2.5
  x = 8.2
  y = t √ x

Of course we don't have to follow mathematical convention with python. However allowing any
unicode symbol as an identifier doesn't prohibit from using √ as an operator. We do have
"in" and "is" as operators now, even if they would otherwise be acceptable identifiers.
So I wonder, would you consider to introduce log as an operator. 2 log x seems an interesting
operation for a programmer.

Antoon Pardon

More information about the Python-list mailing list