[Python-Dev] FW: Bare except clauses in PEP 348

Ron Adam rrr at ronadam.com
Wed Aug 24 19:03:13 CEST 2005


Raymond Hettinger wrote:
 > Hey guys, don't give up your bare except clauses so easily.

Yes, Don't give up.  I often write code starting with a bare except, 
then after it works, stick a raise in it to determine exactly what 
exception I'm catching. Then use that to rewrite a more explicit except 
statement.

Your comment earlier about treating the symptom is also accurate.  This 
isn't just an issue with bare excepts not being allowed in the middle, 
it also comes up whenever we catch exceptions out of order in the tree. 
  Ie.. catching an exception closer to the base will block a following 
except clause that tries to catch an exception on the same branch.

So should except clauses be checked for orderliness?

Regards, Ron



More information about the Python-Dev mailing list