[Python-ideas] Default return values to int and float

Jan Kaliszewski zuo at chopin.edu.pl
Thu Oct 6 23:54:51 CEST 2011


Michael Foord dixit (2011-10-03, 14:55):

> http://msdn.microsoft.com/en-us/library/994c0zb1.aspx
> 
> The pattern there is equivalent to returning an extra result as well as the
> converted value - a boolean indicating whether or not the conversion
> succeeded (with the "converted value" being 0.0 where conversion fails). A
> Python version might look like:
> 
> success, value = float.parse('thing')
> if success:
>     ...

Nice.
+1 from me.

*j




More information about the Python-ideas mailing list