Pycharm Won't Do Long Underscore

Random832 random832 at fastmail.com
Tue Jun 30 22:00:17 EDT 2020


On Wed, Jun 24, 2020, at 21:38, Grant Edwards wrote:
> On 2020-06-24, Peter J. Holzer <hjp-python at hjp.at> wrote:
> 
> > There is U+FF3F Fullwidth Low Line.
> >
> >> If there were, Python would not know what to do with it
> >
> > You can use it in variable names, but not at the beginning, and it isn't
> > equivalent to two underscores, of course:

It is, in fact, equivalent to a single underscore. This is reasonable, given the unicode rules [I assume identifier lookup uses NFKC] and how these characters function for East Asian users.

> Ouch.  Anybody caught using that should be fed to a large snake.

Honestly, if I were to suggest any change it'd be to fix it so it's allowed at the beginning of an identifier. Let each (human) language's community worry about coding conventions for code intended for speakers of that language instead of trying to impose things on the world as english-speakers.

>>> a=1
>>> a_b=2
>>>1
>>> a_b
2
>>> _
  File "<stdin>", line 1
    _
    ^
SyntaxError: invalid character in identifier


More information about the Python-list mailing list