classification
Title: int() doesn't 'guess'
Type: Stage:
Components: Documentation Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: benjamin.peterson, georg.brandl, kjohnson
Priority: normal Keywords:

Created on 2008-09-14 11:58 by kjohnson, last changed 2008-09-14 16:02 by benjamin.peterson. This issue is now closed.

Messages (2)
msg73214 - (view) Author: Kent Johnson (kjohnson) * Date: 2008-09-14 11:58
The library reference for int() says, "If radix is zero, the proper
radix is guessed based on the contents of string; the interpretation is
the same as for integer literals." The use of the word 'guess' implies
that there is some heuristic used here, that somehow the function will
look at an arbitrary number and figure out the correct radix. This can
confuse newbies:
http://mail.python.org/pipermail/tutor/2008-September/064268.html

'determined' might be a better word. For bonus points link to the
Language Reference page on integer literals:
http://docs.python.org/ref/integers.html
msg73227 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-09-14 16:02
Thanks for the suggestion! Fixed in r66459.
History
Date User Action Args
2008-09-14 16:02:49benjamin.petersonsetstatus: open -> closed
nosy: + benjamin.peterson
resolution: fixed
messages: + msg73227
2008-09-14 11:58:05kjohnsoncreate