[EMAIL PROTECTED] wrote: > Heiko Wundram wrote: > > Because sometimes you don't want to call the base classes constructors? > Sounds strange to me at the moment, but I'll try to adjust to this > thought.
In Java and C++, classes have private members that can only be accessed by the class itself (and, in C++, friends). In those languages, a base constructor needs to be called to initialize the base class's private members. Python has no private members (except for the double underscore thingies, which aren't that common). Unlike C++ and Java, the derived class's __init__ can usually initialize all the base class's members, and it's occasionally useful to do so. I would agree it's a mistake to not call the base class's __init__ unless you're doing it deliberately. If you want a tool to catch those mistakes, have a look at pychecker. It can inform you whenever the base class __init__ is not called. (However, I totally disagree that it's a good idea to always call it first, though. I've written base class __init__s that expected the subclass to provide initialization methods, and some of those methods needed some subclass members to exist before they were called.) -- http://mail.python.org/mailman/listinfo/python-list