Numeric literal syntax

Grant Edwards grante at visi.com
Wed Sep 3 11:01:28 EDT 2008


On 2008-09-03, Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:

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

I don't think that standard is applicable.  It's a typesetting
style guide. It also references superscripts, half-high
centered dots, the "cross" multiplication symbol, the degree
symbol and tons of other things which, like the thin space,
can't be represented using the most common text encodings.

It's quite explicit that the separator is a thin space, which
one presumes would not be considered "white space" for
tokenizing purposes.  We don't have a thin-space, and allowing
spaces within numerical literals would throw a major
monkey-wrench into a lot of things (like data files whose
values are separated by a single space).

I suppose you could have a different format for literals in
program source and for the operands to int() and float(), but
that feels like a bad idea.

-- 
Grant Edwards                   grante             Yow! Pardon me, but do you
                                  at               know what it means to be
                               visi.com            TRULY ONE with your BOOTH!



More information about the Python-list mailing list