"Invalid literal for int() with base 10": is it really a literal?
Roel Schroeven
roel at roelschroeven.net
Fri May 26 04:53:03 EDT 2023
Op 26/05/2023 om 10:29 schreef Chris Angelico:
> However, if you want to change the wording, I'd be more inclined to
> synchronize it with float():
>
> >>> float("a")
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ValueError: could not convert string to float: 'a'
>
I was looking for other ValueError-generating functions to find
potentially better wording, and I somehow failed to think of float(), so
thank you for mentioning it :) The ones I could think of were math
functions like math.sqrt(); they give "ValueError: math domain error"
which is rather less user friendly.
--
"'How to Stop Worrying and Learn to Love the Internet':
1) everything that’s already in the world when you’re born is just
normal;
2) anything that gets invented between then and before you turn
thirty is incredibly exciting and creative and with any luck you can
make a career out of it;
3) anything that gets invented after you’re thirty is against the
natural order of things and the beginning of the end of civilisation
as we know it until it’s been around for about ten years when it
gradually turns out to be alright really.
Apply this list to movies, rock music, word processors and mobile
phones to work out how old you are."
-- Douglas Adams
More information about the Python-list
mailing list