exit a program gracefully

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue May 5 13:28:16 CEST 2009


In message <mailman.5079.1241476454.11746.python-list at python.org>, Gabriel 
Genellina wrote:

> I prefer to put the code inside a function, and just `return` earlier.

It would be nice if Python offered a straightforward equivalent to

    ... initialization goes here ...
    do /*once*/
      {
        ... do stuff ...
        if (check1_failed)
            break;
        ... do more stuff ...
        if (check2_failed)
            break;
        ... do even more stuff ...
      }
    while (false);
    ... cleanup goes here ...





More information about the Python-list mailing list