[Zope3-dev] Please, no bare 'except:' clauses!

Barry A. Warsaw barry@zope.com
Mon, 11 Nov 2002 13:43:48 -0500


>>>>> "SH" == Shane Hathaway <shane@zope.com> writes:

    SH> Barry A. Warsaw wrote:
    >> class m:
    | ...   def __int__(self):
    | ...     return sadf
    | ...
    >> int(m())
    SH> Traceback (most recent call last):
    |    File "<stdin>", line 1, in ?
    |    File "<stdin>", line 3, in __int__
    SH> NameError: global name 'sadf' is not defined

    SH> :-)

Under that scenario, bare except is practically mandatory. :)

But do you really need to mask all exceptions when e.g. trying to
int-ify some unknown object?  I'm not sure I'd want to catch those
NameErrors at the point of the int() call.  It surely seems like a
deeper bug I'd want to know about.

-Barry