Numeric literal syntax (was: Py 2.6 changes)

Ben Finney bignose+hates-spam at
Tue Sep 2 03:13:27 CEST 2008

bearophileHUGS at writes:

> For Python 2.7/3.1 I'd now like to write a PEP regarding the
> underscores into the number literals, like: 0b_0101_1111, 268_435_456
> etc.

+1 on such a capability.

-1 on underscore as the separator.

When you proposed this last year, the counter-proposal was made
to instead use white space for the separator, exactly as one can now
do with string literals.

I don't see any good reason (other than your familiarity with the D
language) to use underscores for this purpose, and much more reason
(readability, consistency, fewer arbitrary differences in syntax,
perhaps simpler implementation) to use whitespace just as with string

 \        “When in doubt tell the truth. It will confound your enemies |
  `\   and astound your friends.” —Mark Twain, _Following the Equator_ |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list