Numeric literal syntax

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Sep 3 05:14:03 CEST 2008


Ben Finney <bignose+hates-spam at benfinney.id.au> writes:

> 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
> literals.

Another reason in support of spaces (rather than underscores) to
separate digit groups: it's the only separator that follows the SI
standard for representing numbers:

    … for numbers with many digits the digits may be divided into
    groups of three by a thin space, in order to facilitate reading.
    Neither dots nor commas are inserted in the spaces between groups
    of three.

    <URL:http://www.bipm.org/en/si/si_brochure/chapter5/5-3-2.html#5-3-4>

This isn't binding upon Python, of course. However, it should be a
consideration in choosing what separator convention to follow.

-- 
 \     “If you ever catch on fire, try to avoid seeing yourself in the |
  `\        mirror, because I bet that's what REALLY throws you into a |
_o__)                                             panic.” —Jack Handey |
Ben Finney



More information about the Python-list mailing list