On Apr 12, 12:58 am, Paul Rubin <no.em...@nospam.invalid> wrote:
> zildjohn01 <zildjoh...@gmail.com> writes:
> >     _temp = expr
> >     if _temp: return _temp
>
> I'm trying to figure out a context where you'd even want that, and I'm
> thinking that maybe it's some version of a repeat-until loop?  Python
> doesn't have repeat-until and it's been proposed a few times.

I've wanted that a few times, frequently in a situation where I'm
doing validity checking, and I either want to continue after calling a
validity check or return immediately with some kind of error object.
For example:

returnif self.isitaboojum(snark)

This works nicely if the checking routine either returns False or an
error object.

It also works if the method is doing some kind of a ladder evaluation
of several distinct conditions, and it wants to return the first one
it finds.

Also, I wouldn't want a returnif in a loop. Following on with this
idea, loop control would be more of a breakif or continueif statement.

John Roth
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to