On 1/10/07, Josiah Carlson <[EMAIL PROTECTED]> wrote:
> According to the translation rules Colin has previously provided...
>
> re = get_resource()
> ...
> try:
> something()
> except RareException as re:
> ...
> ...
> re.use_resource()
>
> is translated into...
>
> re = get_resource()
> ...
> try:
> try:
> something()
> except RareException:
> re = <current exception>
> ...
> finally:
> re = None
> del re
> ...
> re.use_resource()
That's not what I understand the transformation to be. I thought the
transformation we were talking about was:
re = get_resource()
...
try:
something()
except RareException, re:
try:
...
finally:
re = None
del re
...
re.use_resource()
Per these rules:
On 1/7/07, Collin Winter <[EMAIL PROTECTED]> wrote:
> > On 1/4/07, Phillip J. Eby <[EMAIL PROTECTED]> 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.
In any event, if I was mistaken about the transformation that occurs,
I apologize and withdraw my SyntaxWarning suggestion.
Greg F
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com