[Python-ideas] 1_000_000

Steven D'Aprano steve at pearwood.info
Sat May 7 10:18:22 CEST 2011


Greg Ewing wrote:
> Philip Jenvey wrote:
> 
>> int x4 = 5_______2;        // OK (decimal literal)
> 
> Hmmm, that one looks really weird -- maybe it should be
> disallowed as well?

I don't think we need disallow it merely over an aesthetic judgement 
(although it does look weird *grins*). There is precedence with 
separators in collections:

 >>> t = (1,,,,2)
   File "<stdin>", line 1
     t = (1,,,,2)
            ^
SyntaxError: invalid syntax

Like consecutive commas, consecutive underscores are likely to indicate 
a typo rather than a deliberate decision. So I'm +1 on strictly 
enforcing a single underscore between digits.



-- 
Steven




More information about the Python-ideas mailing list