> 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 -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/HRMPJNZQWEJIGVDXTS2TGILI5JNNCO25/ Code of Conduct: http://python.org/psf/codeofconduct/
