Karthikeyan Singaravelan <[email protected]> added the comment:
> `int` and `float` required general category Nd, which corresponds to
> `str.isdigit`.
Sorry, did you mean str.isdecimal? since there could be a subset where isdigit
is True and isdecimal returns False.
>>> '\u00B2'.isdecimal()
False
>>> '\u00B2'.isdigit()
True
>>> import unicodedata
>>> unicodedata.category('\u00B2')
'No'
>>> int('\u00B2')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '²'
Is this worth an FAQ or an addition to the existing note on int that specifies
characters should belong to 'Nd' category to add a note that str.isdecimal
should return True
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36100>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com