On 2020-12-27 at 19:55:39 -0300, "Joao S. O. Bueno" <jsbu...@python.org.br> 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 suddenly have to tour the students on several other > concepts just to get a correct user-inputed number. (OTOH, yes, for > code on this level, one normally won't be concerned if the program > user will be typing "1.02e2" on the `input` prompt). OTOH, learning that translating a user-entered string to a floating point number is not as simple as it sounds is a great lesson. Please don't teach beginners that handling user input (let alone floating point arithmetic) is easy and/or foolproof. Start with letting the program fail when the input is invalid, teach them to isolate input validation into its own function(s), and introduce try/except as one method of control flow in a validation function. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/GKMQV75D5PXLTC6SE2V7YFNHLKKPVN52/ Code of Conduct: http://python.org/psf/codeofconduct/