Feature suggestion -- return if true

Westley Martínez anikom15 at gmail.com
Tue Apr 12 19:15:29 EDT 2011


On Tue, 2011-04-12 at 16:06 -0700, Ethan Furman wrote:
> James Mills wrote:
> > Are we done with this discussion yet ? :)
> > *sigh* It was a slow day yesterday and I have
> > a funny feeling it's going to be the same today!
> > 
> > Regardless of anyone's subjective opinions as to what
> > was clear - I still stand by what I said.
> 
> I think I see your point -- the OP said:
> -->    _temp = expr
> -->    if _temp: return _temp
> 
> which is where you're getting
> -->    return _temp or None
> 
> However, most everyone ('cept you, it seems! ;) understood that there 
> would be more lines of code such that if bool(expr) == False no return 
> is executed and the function keeps going merrily along.  Like this:
> --> def func():
> -->     var1 = something()
> -->     var2 = something_else('this')
> -->     return? var1.hobgle(var2)
> -->     var3 = last_resort(var1)
> -->     return var3.wiglat(var2)
> 
> 
> Looking back at the whole post now, I see nothing there to concretely 
> make that point except the question mark on the return.
> 
> Hope this helps.
> 
> ~Ethan~

The question mark makes the programmer look like he wasn't sure of what
he was doing at the time.  "Hmm, should I return this object or not?"




More information about the Python-list mailing list