On Wed, May 8, 2019 at 4:17 AM Oscar Benjamin <oscar.j.benja...@gmail.com> wrote: > Admittedly the non-ASCII unicode digit example is not one that has > actually caused me a problem but what I have had a problem with is > floats. Given that a user of my code can pass in a float in place of a > string the fact that int(1.5) gives 1 can lead to bugs or confusion. > ... > There is no function to parse a decimal integer string without also > accepting floats though.
Explicitly parse in decimal, then. >>> int(1.5, 10) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: int() can't convert non-string with explicit base ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/