Pychecker warns about Exception example from Python tutorial

Ville Vainio ville at spammers.com
Fri Oct 15 14:50:43 EDT 2004


>>>>> "Pekka" == Pekka Niiranen <pekka.niiranen at wlanmail.com> writes:

    Pekka> Hi there,
    Pekka> why does pychecker v0.8.14 gives this warning:

    Pekka> koe2.py:2: Base class (exceptions.Exception) __init__() not called




    Pekka> What does this warning mean and how can I disable it?

You had __init__, and you didn't call the init of the superclass. This
might leave the superclass in uninitialized stage. Your own exception
class is over-engineered, this works the way you want:

--------------------------
In [11]: class MyEx(Exception): pass
   ....:

In [12]: raise MyEx("blah")
---------------------------------------------------------------------------
MyEx                                      Traceback (most recent call last)

/home/ville/<console>

MyEx: blah
---------------------------------

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list