Feature suggestion -- return if true

Ethan Furman ethan at stoneleaf.us
Tue Apr 12 19:06:55 EDT 2011


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~



More information about the Python-list mailing list