else: w/o except: - why not?

Peter Hansen peter at engcorp.com
Tue Apr 1 15:06:10 EST 2003


Jeremy Fincher wrote:
> 
> claird at lairds.com (Cameron Laird) wrote in message news:<v8j9pb3v2cnra6 at corp.supernews.com>...
> > And, for you, does
> >   try:
> >       f1()
> >   except:
> >       f2()
> >       raise
> > become *not* bad practice?
> 
> Wouldn't that be better written like thiS?
> 
> try:
>   f1()
> finally:
>   f2()

Doesn't finally *always* execute, while the example above
would execute f2() only if f1() raised an exception?

-Peter




More information about the Python-list mailing list