On Mon, Dec 28, 2020 at 9:55 AM Joao S. O. Bueno
On Sun, 27 Dec 2020 at 19:31, Chris Angelico
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