On 1/3/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote:
>Or perhaps translate blocks of the form:
>
>      except ExcType, e:
>          # body
>
>to:
>
>      except ExcType, e:
>          try:
>              # body
>          finally:
>              del e

That's much nicer!  (I feel silly now for not realizing there was
no need for the weakref...)

> Actually, on second thought it occurs to me that the above code isn't a
> 100% correct translation, because if "body" contains its own "del e", then
> it will fail.  So a pure translation strategy isn't really practical,
> unfortunately.  We'd have to generate something like:
>
>      if 'e' in locals():
>          del e

How about this?

     except ExcType, e:
         try:
             # body
         finally:
             e = None


-- ?!ng
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to