fun with nested loops

Chris Angelico rosuav at gmail.com
Wed Aug 31 15:15:42 EDT 2011


On Thu, Sep 1, 2011 at 5:07 AM, Daniel <dalist0 at gmail.com> wrote:
>> Do you only ever have one top-level loop that you would be naming? If
> no, unfortunately not. The rough structure is several loops deep, and
> I need to break/continue/restart many of them.
> Continue is used more than break, because most of the time that I find
> some strange value, I'd just _continue_ a few levels up
> to restart the current measurements.
>

Ah well, was worth a try. Raising exceptions smells wrong for this,
but peppering your code with sentinel checks isn't much better. I
don't really know what would be a good solution to this... except
maybe this, which was proposed a few years ago and which I'd never
heard of until Google showed it to me just now:
http://entrian.com/goto/

ChrisA



More information about the Python-list mailing list