[Python-ideas] Re: str.isfloat()

2020-12-28 Thread Tushar Sadhwani
Alright, I see why `str.isfloat()` isn't a thing, and having a builtin float validation function was besides the point anyway. Thanks for the clarifications :) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to

[Python-ideas] Re: str.isfloat()

2020-12-27 Thread Cade Brown
You should really just write your own function -- Python can't include every validation function you can think of. It already provides an extensible and well tested float conversion which throws an exception on bad input (the 'float' constructor) You want it to not throw an exception, but rather

[Python-ideas] Re: str.isfloat()

2020-12-27 Thread 2QdxY4RzWzUUiLuE
On 2020-12-27 at 19:55:39 -0300, "Joao S. O. Bueno" wrote: > I tried to make clear this should be in addition to that - But yes, I > failed to mention in my message that I think such a function would > mostly benefit beginners learning around with "input" and "print" - it > is painful to

[Python-ideas] Re: str.isfloat()

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

[Python-ideas] Re: str.isfloat()

2020-12-27 Thread Joao S. O. Bueno
On Sun, 27 Dec 2020 at 19:31, Chris Angelico wrote: > On Mon, Dec 28, 2020 at 9:22 AM Joao S. O. Bueno > wrote: > > > > I agree - the three builtin methods are almost the same (not sure if > > there is any difference at all), > > Yes - they all check if the string matches a particular set of

[Python-ideas] Re: str.isfloat()

2020-12-27 Thread Chris Angelico
On Mon, Dec 28, 2020 at 9:22 AM Joao S. O. Bueno wrote: > > I agree - the three builtin methods are almost the same (not sure if > there is any difference at all), Yes - they all check if the string matches a particular set of characters. > while there is no trivial way to check for a valid >

[Python-ideas] Re: str.isfloat()

2020-12-27 Thread Joao S. O. Bueno
I agree - the three builtin methods are almost the same (not sure if there is any difference at all), while there is no trivial way to check for a valid float, or otherwise a chosen representation of a decimal number without resorting to a try-except statement, or complicated verification schemes