Author r.david.murray
Recipients docs@python, ezio.melotti, r.david.murray, shreevatsa, vstinner
Date 2015-09-30.13:16:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1443618994.4.0.699857306819.issue25275@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-09-30 13:16:34r.david.murraysetrecipients: + r.david.murray, vstinner, ezio.melotti, docs@python, shreevatsa
2015-09-30 13:16:34r.david.murraysetmessageid: <1443618994.4.0.699857306819.issue25275@psf.upfronthosting.co.za>
2015-09-30 13:16:34r.david.murraylinkissue25275 messages
2015-09-30 13:16:33r.david.murraycreate