R. David Murray added the comment:

Apparently that documentation is simply wrong.  The actual definition of what 
'int' handles is *different* from what the parser handles.  I think that 
difference must constitute a bug (not just a doc bug), but I'm not sure if it 
is something that we want to fix (changing the parser).

I think the *operational* definition of int conversion for both is the same as 
for isdigit in python3 
(https://docs.python.org/3/library/stdtypes.html#str.isdigit).  (The python2 
docs just say '8 bit strings may be locale dependent', which means the same 
thing but is less precise).

>>> १२३४
  File "<stdin>", line 1
    १२३४
       ^
SyntaxError: invalid character in identifier
>>> int('१२३४')
1234
>>> '१२३४'.isdigit()
True

The above behavior discrepancy doesn't apply to python2, since in python2 you 
can't use unicode in integer literals.

So, this is a bit of a mess :(.

The doc fix is simple: just replace the mention of integer literal with a link 
to isdigit, and fix the python2 isdigit docs to match python3's.

----------
nosy: +r.david.murray
stage:  -> needs patch
type:  -> behavior
versions: +Python 2.7, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25275>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to