[Python-3000] Pre-peps on raise and except changes (was: Warning for 2.6 and greater)
Giovanni Bajo
rasky at develer.com
Wed Jan 24 02:13:35 CET 2007
On 22/01/2007 23.45, Collin Winter wrote:
> target, thus eliminating the reference cycle. The source-to-source
> translation, as suggested by Phillip J. Eby [#except-translation]_ is
> ::
>
> try:
> ...
> except E as N:
> ...
> ...
>
> is translated to ::
>
> try:
> ...
> except E as N:
> ...
> N = None
> del N
> ...
>
The mail you link (which matched my recollection of the thread) has an
additional try/finally suite in the except block translation:
except ExcType, e:
try:
# body
finally:
e = None
del e
which is missing in the PEP. I think you should probably explain why the
try/finally is not needed (if it really is not).
Also, the second code snippet should probably use the "except E, N" form (no
"as") to make more clear that you're speaking of the Python 2.x equivalent of
the 3.x form.
--
Giovanni Bajo
More information about the Python-3000
mailing list