Message191302
I took another look at the library reference and it looks like when it comes to non-ascii digits support, the reference contradicts itself. On one hand,
"""
int(x, base=10)
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in radix base. Optionally, the literal can be preceded by + or - (with no space in between) and surrounded by whitespace.
""" <http://docs.python.org/3/library/functions.html#int>
.. suggests that only "an integer literal" will be accepted by int(), but on the other hand, a note in the "Numeric Types" section says: "The numeric literals accepted include the digits 0 to 9 or any Unicode equivalent (code points with the Nd property)." <http://docs.python.org/3/library/stdtypes.html#typesnumeric>
It also appears that "surrounded by whitespace" part is not entirely correct:
>>> '\N{RS}'.isspace()
True
>>> int('123\N{RS}')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '123\x1e'
This is probably a bug in the current implementation and I will open a separate issue for that. |
|
Date |
User |
Action |
Args |
2013-06-17 00:56:47 | belopolsky | set | recipients:
+ belopolsky, lemburg, mark.dickinson, ncoghlan, vstinner, eric.smith, ezio.melotti, eric.araujo, cvrebert, skrah |
2013-06-17 00:56:47 | belopolsky | set | messageid: <1371430607.66.0.0911786333223.issue10581@psf.upfronthosting.co.za> |
2013-06-17 00:56:47 | belopolsky | link | issue10581 messages |
2013-06-17 00:56:46 | belopolsky | create | |
|