Proposal: Decimal literals in Python.

MRAB google at mrabarnett.plus.com
Sat Oct 27 10:09:44 EDT 2007


On Oct 27, 12:12 am, Ben Finney <bignose+hates-s... at benfinney.id.au>
wrote:
> Matimus <mccre... at gmail.com> writes:
> > The trailing L [for 'long' literals] is going away in Python 3.0.
>
> Yes. On the other hand, we are gaining '0bNNNN' for binary literals,
> to go along with '0oNNNN' for octal and '0xNNNN' for hexadecimal.
>
> So, the original poster might get further by proposing an '0dNNN.NNN'
> syntax for 'decimal.Decimal' literals. At least the syntax would be
> consistent and wouldn't add a new punctuation character to the
> language...
>
[snip]
Some languages have or permit 0qNNNN or 0QNNNN for octal to reduce the
chance of confusion of 'O' (oh) with '0' (zero) in uppercase, eg.
0Q123 is clearer than 0O123 (0 oh 123), although lowercase is better,
eg. 0q123 or 0o123.




More information about the Python-list mailing list