# [Python-ideas] Disallow "00000" as a synonym for "0"

Nick Coghlan ncoghlan at gmail.com
Mon Jul 20 06:48:02 CEST 2015

```On 20 July 2015 at 12:01, Steven D'Aprano <steve at pearwood.info> wrote:
> On Mon, Jul 20, 2015 at 10:38:02AM +1000, Nick Coghlan wrote:
>
>> Exactly - the special case here is *dis*allowing leading zeroes for
>> non-zero integer literals,
>
> That's a ... different ... definition of "special case". You're saying
> that, out of the literally infinite number of possible ints one might
> attempt to write, *all of them except zero* are the special case, while
> zero itself is the non-special case. O-kay.

The integer literal zero only looks like the special case if you first
exclude all the *other* ways of entering numeric values into Python
applications and only consider "integer literal zero" and "non-zero
integer literals".

The fact that "0", "0.0" and "0j" produce values of different types is
an implementation detail of Python's representation of abstract
mathematical concepts, so the general case is actually "you can write
numbers in Python the same way you write them in mathematical
notation, including with leading zeroes if you want" (with the caveat
that we use the electrical engineering "j" for imaginary numbers,
rather than the more confusable mathematical "i")

The Python 2 special case is then "unlike mathematical notation, using
leading zeroes on an integer literal will result in it being
interpreted in base 8 rather than base 10".

The corresponding Python 3 special case is "unlike mathematical
notation, you can't use leading zeroes on non-zero integers in Python
3, because of historical reasons relating to the syntax previously
used for octal numbers in Python 2, and still used in C/C++, and
various other languages".

Regards,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
```