[Python-ideas] 1 246 358 (was: 1_000_000)

Ben Finney ben+python at benfinney.id.au
Sat May 7 02:44:09 CEST 2011


Greg Ewing <greg.ewing at canterbury.ac.nz> writes:

> An alternative would be to allow spaces.

I would prefer to allow space between digits in a numeric literal.

    1 2345 6789
    1 2 3 4 5 6789
    1 234 6789
    1  234   567 89
    9.876 543 210
    0xFEFF 0042

This nicely parallels the fact that space can separate chunks of a
string literal.

But that still leaves the following inconsistency:

    int('1 234 567')

That will currently raise a ValueError. Should it continue to do so
under this proposal?

-- 
 \      “You say “Carmina”, and I say “Burana”, You say “Fortuna”, and |
  `\    I say “cantata”, Carmina, Burana, Fortuna, cantata, Let's Carl |
_o__)                                the whole thing Orff.” —anonymous |
Ben Finney




More information about the Python-ideas mailing list