Author shreevatsa
Recipients docs@python, ezio.melotti, r.david.murray, shreevatsa, vstinner
Date 2015-09-30.20:45:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1443645910.44.0.490510591942.issue25275@psf.upfronthosting.co.za>
In-reply-to
Content
Minor difference, but the relevant function for int() is not quite isdigit(), e.g.:

    >>> import unicodedata
    >>> s = u'\u2460'
    >>> unicodedata.name(s)
    'CIRCLED DIGIT ONE'
    >>> print s
    ①
    >>> s.isdigit()
    True
    >>> s.isdecimal()
    False
    >>> int(s)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    UnicodeEncodeError: 'decimal' codec can't encode character u'\u2460' in position 0: invalid decimal Unicode string

It seems to be isdecimal(), plus if there are other digits in the string then many leading and trailing space-like characters are also allowed (e.g. 5760 OGHAM SPACE MARK or 8195 EM SPACE or 12288 IDEOGRAPHIC SPACE:

    >>> 987 == int(u'\u3000\n 987\u1680\t')
    True
History
Date User Action Args
2015-09-30 20:45:10shreevatsasetrecipients: + shreevatsa, vstinner, ezio.melotti, r.david.murray, docs@python
2015-09-30 20:45:10shreevatsasetmessageid: <1443645910.44.0.490510591942.issue25275@psf.upfronthosting.co.za>
2015-09-30 20:45:10shreevatsalinkissue25275 messages
2015-09-30 20:45:10shreevatsacreate