[Python-Dev] Bare except clauses in PEP 348
Barry Warsaw
barry at python.org
Wed Aug 24 20:25:21 CEST 2005
On Wed, 2005-08-24 at 12:38, "Martin v. Löwis" wrote:
> I personally dislike recording the execution path in
> local variables. This is like setting a flag in a loop
> before the break, and testing the flag afterwards.
> You can do this, but the else: clause of the loop is
> just more readable.
Agreed!
> This specific fragment has also the bug that a
> KeyboardInterrupt before the assignment to complete
> will cause a NameError/UnboundLocalError; this
> can easily be fixed by moving the assignment before
> the try block.
And that begs the question whether getting rid of this common idiom is
trading one common problem for another.
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20050824/eeedd633/attachment.pgp
More information about the Python-Dev
mailing list