On Mon, Dec 28, 2020 at 9:55 AM Joao S. O. Bueno <[email protected]> wrote:
> On Sun, 27 Dec 2020 at 19:31, Chris Angelico <[email protected]> wrote:
> Sorry, I thought my message conveyed that I know "float" exists, and
> try/except is the current usable pattern (it is in the original posting 
> anyway)

And my point is that try/except is a perfectly usable pattern. You
don't need to probe a string to figure out if you'd then be able to
convert it to a float - just attempt the conversion.

> The point is exactly that parsing a number correctly, and moreover respecting
> these options, is subject to error and the stdlib could benefit from
> a construct that would not require a try/except block for everything.
> (As you can see, I contemplate that raising may be a desired option for
> a flexible function, and there is an option for that in my example signature) 
> .

You can always write the flexibility yourself. Most of the time you
won't need anything like that much flexibility.

ChrisA
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/2SRSZQLR326SYNAWTPZY2A6PQ4BK6BWE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to