Feature suggestion -- return if true

James Mills prologic at shortcircuit.net.au
Mon Apr 11 20:27:55 EDT 2011


On Tue, Apr 12, 2011 at 9:17 AM, zildjohn01 <zildjohn01 at gmail.com> wrote:
> This is an idea I've had bouncing around in my head for a long time
> now. I propose the following syntax:

Maybe this is more appropriare for the python-ideas list ?

>    return? expr

This syntax does not fit well within python ideology.

> be expanded to
>
>    _temp = expr
>    if _temp: return _temp

This could be simplified to just:

return expr or None

And more to the point... If your calee is relying
on the result of this function, just returning the
evaluation of "expr" is enough.

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"



More information about the Python-list mailing list