[issue36100] int() and float() should accept any isnumeric() digit

Marcos Dione report at bugs.python.org
Sun Feb 24 04:02:22 EST 2019


New submission from Marcos Dione <mdione at grulic.org.ar>:

Following https://blog.lerner.co.il/pythons-str-isdigit-vs-str-isnumeric/, we have this:

Python 3.8.0a1+ (heads/master:001fee14e0, Feb 20 2019, 08:28:02)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> '一二三四五'.isnumeric()
True

>>> int('一二三四五')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '一二三四五'

>>> float('一二三四五')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: could not convert string to float: '一二三四五'

I think Reuven is right, these should be accepted as input. I just wonder if we should do the same for f.i. roman numerics...

----------
components: Library (Lib)
messages: 336451
nosy: StyXman
priority: normal
severity: normal
status: open
title: int() and float() should accept any isnumeric() digit
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36100>
_______________________________________


More information about the Python-bugs-list mailing list