If the end goal is to just get either a float or an int from a string, and
you want to only accept floats the way Python spells them, what about using
ast.literal_eval?

>>> type(ast.literal_eval('1'))
<class 'int'>
>>> type(ast.literal_eval('1.0'))
<class 'float'>
>>> type(ast.literal_eval('01_105e-3'))
<class 'float'>


On Sun, Oct 3, 2021 at 1:31 AM Debashish Palit <dpali...@outlook.com> wrote:

> There are plenty of use cases if you pause to think. The other objections
> are trivial. Even the simplest usage with the input() function is enough to
> warrant its inclusion, considering that there are other useless string
> methods.
>
> As I have had no support for the past few days, I quit the discussion.
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/VJV3A4GDV2MLUUEBSFOTWJBZ2F6LDXF3/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/6WBGEYEXFSVXWPUDJ7EITLWICIU4KS74/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to