Proposal: Decimal literals in Python.

Paul Hankin paul.hankin at gmail.com
Sat Oct 27 17:27:47 CEST 2007


On Oct 27, 3:09 pm, MRAB <goo... at mrabarnett.plus.com> wrote:
> 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.

Even clearer is not to allow octal literals :) Is there *any* use for
them?

--
Paul Hankin




More information about the Python-list mailing list