exit a program gracefully

Scott David Daniels Scott.Daniels at Acm.Org
Tue May 5 09:47:03 EDT 2009


Lawrence D'Oliveiro wrote:
> It would be nice if Python offered a straightforward equivalent to
>     ...
>     do /*once*/
>       {
>         ... do stuff ...
>         if (check1_failed)
>             break;
>         ... do even more stuff ...
>       }
>     while (false);
>     ... cleanup goes here ...

What's wrong with:

     for _ in (None,):
         ... do stuff ...
         if (check1_failed)
             break;
         ... do even more stuff ...
     ... cleanup ...

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list