Feature suggestion -- return if true

zildjohn01 zildjohn01 at gmail.com
Mon Apr 11 19:17:25 EDT 2011

This is an idea I've had bouncing around in my head for a long time
now. I propose the following syntax:

    return? expr

be expanded to

    _temp = expr
    if _temp: return _temp

It's a pattern I use all the time in my code, and although it's a bit
unorthodox, IMO it's concise, readable, and easily understandable.


More information about the Python-list mailing list