[Python-Dev] PEP 515: Underscores in Numeric Literals

Serhiy Storchaka storchaka at gmail.com
Thu Feb 11 05:17:00 EST 2016


On 11.02.16 00:20, Georg Brandl wrote:
> **Group 1: liberal (like this PEP)**
>
> * D [2]_
> * Perl 5 (although docs say it's more restricted) [3]_
> * Rust [4]_
> * Swift (although textual description says "between digits") [5]_
>
> **Group 2: only between digits, multiple consecutive underscores**
>
> * C# (open proposal for 7.0) [6]_
> * Java [7]_
>
> **Group 3: only between digits, only one underscore**
>
> * Ada [8]_
> * Julia (but not in the exponent part of floats) [9]_
> * Ruby (docs say "anywhere", in reality only between digits) [10]_

C++ is in this group too.

The documentation of Perl explicitly says that Perl is in this group too 
(23__500 is not legal). Perhaps there is a bug in Perl implementation. 
And may be Swift is intended to be in this group.

I think we should follow the majority of languages and use simple rule: 
"only between digits".

I have provided an implementation.



More information about the Python-Dev mailing list