char** to {'':('',)}
Alex Martelli
aleax at aleax.it
Tue Sep 4 10:29:06 EDT 2001
"David Bolen" <db3l at fitlinxx.com> wrote in message
news:uzo8bztzc.fsf at ctwd0143.fitlinxx.com...
> Grant Griffin <not.this at seebelow.org> writes:
>
> > I can't say I use them much, but I _am_ a big fan of the
> > "almost-goto" constructs like return, break, and continue. In
> > particular, I like to do early returns to avoid needless nesting.
>
> While I do use them at times, of the various control interruption
> constructs, early returns are probably the least preferable for me of
> the bunch, mostly because they increase the risk of missing some
> needed cleanup - either when initially written or later when
That's why try/finally was introduced -- ENSURE "needed cleanup"
does get performed no matter how the try-block is exited (this
includes return as well as exceptions).
> maintained. They can also complicate the maintenance of code since
> there are many exits from a function complicating analysis.
With finalization in the finally clause, "early returns" and
try/finally merge beautifully to ensure maintainable code.
Alex
More information about the Python-list
mailing list