This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients steven.daprano
Date 2015-07-19.10:58:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1437303517.79.0.631832090122.issue24668@psf.upfronthosting.co.za>
In-reply-to
Content
As discussed on the python-ideas list here:

Subject: Disallow "00000" as a synonym for "0"
https://mail.python.org/pipermail/python-ideas/2015-July/034631.html

and on Stackoverflow, leading zeroes are forbidden for ints, due to the possible confusion with C-style octal literals e.g. 007 raises syntax error. However, zero itself allows an arbitrary number of leading zeroes, e.g. 000 is accepted. Nobody seems to know why this special case was allowed in the first place, or come up with a use-case for it.

I propose deprecating this: 0 will be the one canonical way to write a zero int in base 10. 00 000 etc should raise a compile-time deprecation warning, to be eventually turned into a syntax error same as 01 002 etc. Float literals, string conversions, and bin/oct/hex literals will remain unchanged.

Cons: if there is anyone out there typing `000` when `0` will do, this will complain noisily.

Pros: cleaner syntax; some typos which may be silently accepted (`00` for `90`) will be caught.
History
Date User Action Args
2015-07-19 10:58:37steven.dapranosetrecipients: + steven.daprano
2015-07-19 10:58:37steven.dapranosetmessageid: <1437303517.79.0.631832090122.issue24668@psf.upfronthosting.co.za>
2015-07-19 10:58:37steven.dapranolinkissue24668 messages
2015-07-19 10:58:37steven.dapranocreate