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
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
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
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
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
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
>
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