[issue43566] Docs say int('010', 0) is not legal, but it is

Chris Wilson report at bugs.python.org
Sat Mar 20 02:19:44 EDT 2021


New submission from Chris Wilson <wilscm at gmail.com>:

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).

----------
assignee: docs at python
components: Documentation
messages: 389145
nosy: docs at python, wilscm
priority: normal
severity: normal
status: open
title: Docs say int('010', 0) is not legal, but it is
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43566>
_______________________________________


More information about the Python-bugs-list mailing list