[Python-3000] self-contained exceptions
Josiah Carlson
jcarlson at uci.edu
Wed Jan 10 19:23:26 CET 2007
"Greg Falcon" <veloso at verylowsodium.com> wrote:
[snip]
> Per these rules:
> On 1/7/07, Collin Winter <collinw at gmail.com> wrote:
> > > On 1/4/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> > > > except ExcType, e:
> > > > try:
> > > > # body
> > > > finally:
> > > > e = None
> > > > del e
> > The transformation is as Phillip outlined above, with extra logic to
> > handle the case where e is a tuple or list.
>
> Perhaps the example transformation you provided is better, in that at
> least you can't make the mistake I'm worried about. But it seems a
> bit gratuitous (and expensive) to delete N variables when there are N
> except clauses.
You are right. Hrm... I see the reasoning behind putting the finally
clause inside the except suite, but I can't help feeling that it would
be better outside. Yeah you delete the name every time, but I think
consistancy would be better in this case (also, deleting a local is
really fast, I wouldn't worry about time considerations).
- Josiah
More information about the Python-3000
mailing list