Sybren Stuvel wrote:

> Ant enlightened us with:
>>     try:
>>         assertion = callable.is_assertion
>>     except:
>>         pass
>
> Try to make a habit out of catching only the exceptions you know will
> be thrown. Catching everything generally is a bad idea. In this case,
> my bet is that catching AttributeError is enough.

and

    assertion = hasattr(callable, "is_assertion")

is even nicer (and can be done as part of the if-statement after the call, in-
stead of in a separate try/except before the call)

</F> 



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to