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

Paul Moore p.f.moore at gmail.com
Tue Oct 4 10:51:00 CEST 2011


On 4 October 2011 09:41, David Townshend <aquavitae69 at gmail.com> wrote:
> Same functionality, but try_convert is a function with lots of arguments
> whereas my alternative is an expression.  But to be honest, I don't really
> like either.  In cases that require the level of control that try_convert
> provides, the try statement is cleaner.  The point I'm really trying to make
> is that my initial proposal was for a specific but common use case (float
> and int), not a general-purpose conversion tool.

I think the point you're missing is that most people here don't see
using a default in place of garbage input (as opposed to just for
empty input) as a "common" use case. Certainly not common enough to
warrant a language change rather than a private utility function...

Paul.



More information about the Python-ideas mailing list