On Tue, 2011-04-12 at 07:58 -0700, scattered wrote: > On Apr 12, 10:05 am, Westley Martínez <aniko...@gmail.com> wrote: > > On Tue, 2011-04-12 at 12:44 +1000, Chris Angelico wrote: > > > On Tue, Apr 12, 2011 at 12:20 PM, James Mills > > > <prolo...@shortcircuit.net.au> wrote: > > > > On Tue, Apr 12, 2011 at 12:18 PM, Jason Swails <jason.swa...@gmail.com> > > > > wrote: > > > >> 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! > > > > > 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. > > > > > Chris Angelico > > > > def bs(x): > > while not x: > > <modify x> > > return x > > > > Am I wrong here?- Hide quoted text - > > > > - Show quoted text - > > I don't think that this is equivalent. The OP's original idea doesn't > involve a loop, but this does - how could that be equivalent?
Not OP's idea, Angelico's. -- http://mail.python.org/mailman/listinfo/python-list