Feature suggestion -- return if true

Zero Piraeus schesis at gmail.com
Mon Apr 11 22:43:44 EDT 2011


:
>> This is only true if n < 5.  Otherwise, the first returns None and the
>> second returns False.
>> Which is why I said:
>> return expr or None
>> But hey let's argue the point to death!

Ok ;-)
I think the point is that OP doesn't want to return *at all* if expr
is False - presumably because there are further statements after the
proposed 'conditional' return.
Anyway,
 return? expr
isn't very pythonic - so how about one of these?
 return expr if True
 return expr else continue
I kid, I kid ...
 -[]z.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /