The Most Diabolical Python Antipattern

Marko Rauhamaa marko at pacujo.net
Fri Jan 30 10:30:08 EST 2015


Ian Kelly <ian.g.kelly at gmail.com>:

> The bare raise re-raises the most recent exception that is being
> handled. The "raise e" raises that exception specifically, which is
> not the most recent in the case of a secondary exception.

Scary. That affects all finally clauses. Must remember that.

The pitfall is avoided by using the "except: pass" antipattern but then
you lose exception chaining.


Marko



More information about the Python-list mailing list