Feature suggestion -- return if true

Chris Angelico rosuav at gmail.com
Mon Apr 11 22:49:28 EDT 2011


On Tue, Apr 12, 2011 at 12:43 PM, Zero Piraeus <schesis at gmail.com> wrote:
>  return? expr
>
> isn't very pythonic - so how about one of these?
>
>  return expr if True
>  return expr else continue
>
> I kid, I kid ...

Or:

if expr:
  return it

Actually, I'm not sure how stupid an idea that is. Inside an if, 'it'
is the value of the condition. Might actually be useful in a few
places.... Naw, I think it's still a stupid idea.

Chris Angelico



More information about the Python-list mailing list