getattr and method name
Gary Herron
gherron at islandtraining.com
Sun Oct 2 21:13:07 EDT 2011
On 10/02/2011 05:24 PM, Kevin Walzer wrote:
> Turns out the error was a typo in the actual method being
> called...*faceinhands*
>
> Sorry for the noise.
>
But this is a great example of why you should not use a naked except
clause. As stated, your code will execute the except clause for *any*
kind of an error, not just the exception you envisioned when you wrote
it. If you had written the except clause to catch just the exceptions
you were interested in, then the exception int a called function would
have come through that code as in un-handled exception, instead of being
caught and essentially ignored.
Gary Herron
More information about the Python-list
mailing list