On 2011-04-12, James Mills <[email protected]> wrote:
> On Tue, Apr 12, 2011 at 12:44 PM, Chris Angelico <[email protected]> wrote:
>> That's still not equivalent. "return expr or None" will always
>> terminate the function. The OP's request was for something which would
>> terminate the function if and only if expr is non-false.
>
> The OP did not state this at all.
> There was never any mention of early termination
> of the function iif expr was True.
The OP said he wanted something with the semantics of
_temp_ = expr
if _temp_: return _temp_
That code snippet does not return if expr is false. What you proposed
returns None when expr is false.
--
Grant Edwards grant.b.edwards Yow! Well, I'm INVISIBLE
at AGAIN ... I might as well
gmail.com pay a visit to the LADIES
ROOM ...
--
http://mail.python.org/mailman/listinfo/python-list