Why Python don't accept 03 as a number?

Antoon Pardon antoon.pardon at vub.be
Mon Dec 10 04:48:25 EST 2018

On 8/12/18 09:35, Ian Kelly wrote:
> On Fri, Dec 7, 2018 at 11:56 PM Henrik Bengtsson
> <henrik.bengtsson at gmail.com> wrote:
>> A comment from the sideline: one could imagine extending the Python syntax
>> with a (optional) 0d prefix that allows for explicit specification of
>> decimal values. They would "complete" the family:
>> * 0b: binary number
>> * 0o: octal number
>> * 0d: decimal number
>> * 0x: hexadecimal number
> That's nice and elegant, but what would be the use case?

A use case is that sometimes numbers are a code for something else and this
something else is more recognizable if all such coded numbers are written in
a common length. The normal way to write such numbers in a common length
is to start the number with sufficient zeroes. But that can now only
be done in binary, octal and hexadecimal notation.


More information about the Python-list mailing list