On 2011-04-12, James Mills <prolo...@shortcircuit.net.au> wrote: > On Tue, Apr 12, 2011 at 4:08 PM, Nobody <nob...@nowhere.com> wrote: >> It should be abundantly clear that this only returns if the expression is >> considered true, otherwise it continues on to the following statements. > > Uggh come on guys. We've been over this. > You cannot make that assumption.
You most certain can. Try it yourself in an interpreter. The OP's code snippit will not return if expr is false, rather it will continue executing in the current context: >>> def foo(expr): ... __temp__ = expr # these two lines are ... if __temp__: return __temp__ # the OP's code snippet ... print "the code snippet did not return" ... >>> print foo(9) 9 >>> >>> print foo(0) the code snippet did not return None >>> -- Grant Edwards grant.b.edwards Yow! One FISHWICH coming at up!! gmail.com -- http://mail.python.org/mailman/listinfo/python-list