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.

classification
Title: Bug in lots of 0s
Type: behavior Stage: resolved
Components: Build Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, serhiy.storchaka, steven.daprano, wyz23x2
Priority: normal Keywords:

Created on 2020-02-11 11:04 by wyz23x2, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg361796 - (view) Author: wyz23x2 (wyz23x2) * Date: 2020-02-11 11:04
Why is this?
>>> 0000000000000000000000000000000 # No error
0
>>> 0000000000000000000000000000002
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
msg361797 - (view) Author: wyz23x2 (wyz23x2) * Date: 2020-02-11 11:09
0000000000002 is not supported;
So 000000000000000 should not too.
msg361805 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2020-02-11 12:21
Its not a bug, it's deliberately designed that way. 0000 is not ambiguous: it's just zero, in any base. 0012 is ambiguous.

There's a recent thread about it here:

https://mail.python.org/archives/list/python-ideas@python.org/message/7IKEXSMVVDOTLHA7CNI7MIOBK4EU2ZSG/


If you want to change the behaviour, your first step is to get a consensus on the mailing list that it should change.
History
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83789
2020-02-11 12:21:08steven.dapranosetstatus: open -> closed

nosy: + steven.daprano
messages: + msg361805

resolution: not a bug
stage: resolved
2020-02-11 12:12:32vstinnersetnosy: + serhiy.storchaka, BTaskaya
2020-02-11 11:09:45wyz23x2setmessages: + msg361797
2020-02-11 11:04:38wyz23x2settitle: Bug in 00000000000000000 -> Bug in lots of 0s
2020-02-11 11:04:06wyz23x2create