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: Docs say int('010', 0) is not legal, but it is
Type: Stage: resolved
Components: Documentation Versions: Python 3.10
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, wilscm
Priority: normal Keywords:

Created on 2021-03-20 06:19 by wilscm, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg389145 - (view) Author: Chris Wilson (wilscm) Date: 2021-03-20 06:19
The documentation for the int() builtin says:

Base 0 means to interpret exactly as a code literal, so that the actual base is 2, 8, 10, or 16, and so that int('010', 0) is not legal, while int('010') is, as well as int('010', 8).

https://docs.python.org/3/library/functions.html#int

However 010 is a valid code literal, and int('010', 0) is legal (both are correctly interpreted as octal).
msg389146 - (view) Author: Chris Wilson (wilscm) Date: 2021-03-20 07:27
Actually, octal is not a legal literal in Python 3, sorry.
History
Date User Action Args
2022-04-11 14:59:43adminsetgithub: 87732
2021-03-20 07:30:40rhettingersetstatus: open -> closed
stage: resolved
2021-03-20 07:27:25wilscmsetresolution: rejected
messages: + msg389146
2021-03-20 06:19:44wilscmcreate