> As I have mentioned above, EAFP is fine but you have to apply it twice. > str.float accomplishes the same with 1 line of code. > num = float(s) if s.float() else int(s)
There is a typo in my reply as quoted: it should be .isfloat() and not .float() . _______________________________________________ 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/HRMPJNZQWEJIGVDXTS2TGILI5JNNCO25/ Code of Conduct: http://python.org/psf/codeofconduct/