Pycharm Won't Do Long Underscore

Peter J. Holzer hjp-python at hjp.at
Wed Jun 24 17:10:16 EDT 2020


On 2020-06-24 13:48:18 -0400, Dennis Lee Bieber wrote:
> On Tue, 23 Jun 2020 20:49:36 +0000, Tony Kaloki <tkaloki at live.co.uk>
> declaimed the following:
> > Alexander,
> > Thank you so much! It worked! Thank you. One question: in your
> > reply, are you saying that Python would have treated the two
> > separate underscores the same way as a long  underscore i.e. it's a
> > stylistic choice rather than a functional necessity?
> 
> 	There is no "long underscore" in the character set.

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:

    Python 3.9.0b3 (default, Jun 13 2020, 10:49:29)
    [GCC 7.5.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> _ = 12
      File "<stdin>", line 1
        _ = 12
        ^
    SyntaxError: invalid character '_' (U+FF3F)
    >>> a_ = 12
    >>> a_
    12
    >>> a__
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'a__' is not defined
    >>>

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20200624/0443c1e1/attachment.sig>


More information about the Python-list mailing list