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: Revise builtin class int library manual entry
Type: Stage:
Components: Documentation Versions: Python 3.0
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, terry.reedy
Priority: normal Keywords:

Created on 2008-04-08 02:26 by terry.reedy, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg65137 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2008-04-08 02:26
Based on c.l.p discussion with Mark Dickinson, who supplied details and
corrections, we propose the following for the int() entry at
http://docs.python.org/dev/3.0/library/functions.html#int

int([number | string[, radix]])
Convert a number or string to an integer.  If no arguments are given,
return 0.  If a number is given, return number.__int__().  Conversion of
floating point numbers to integers truncates towards zero.  A string
must be a base-radix integer literal optionally preceded by '+' or '-'
(with no  space in between) and optionally surrounded by whitespace.  A
base-n literal consists of the digits 0 to n-1, with 'a' to 'z' (or 'A'
to 'Z')having values 10 to 35.  The default radix is 10. The allowed
values are 0 and 2-36.  Base-2, -8, and -16 literals can  be optionally
prefixed with 0b/0B, 0o/0O, or 0x/0X, as with integer literals in code.
 Radix 0 means to interpret exactly as a code literal, so that the
actual radix is 2, 8, 10, or 16, and so that int('010',0) is not legal,
while int('010') is.

The revised signature makes it clear from the start that *radix* can
only follow *string*, so no sentence to that effect is needed in the
text.  The other changes are to discuss the signature in order and to
add details.  We believe the above accurately reflects the
intended/actual behavior once the no-space-after-sign patch is applied.
 (I don't know if that made it into .0a4).

Some of this might apply to the 2.6 docs, except that the no-space patch
will apparently not be backported.  I believe the acceptable strings are
a bit different also, at least for octals, but I am not sure.
msg65252 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-04-09 18:45
Committed as r62253. Thanks!
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46832
2008-04-09 18:45:24georg.brandlsetstatus: open -> closed
resolution: accepted
messages: + msg65252
2008-04-08 02:26:14terry.reedycreate