OOP in python
sismex01 at hebmex.com
sismex01 at hebmex.com
Wed Mar 12 09:45:51 EST 2003
More information about the Python-list mailing list
Wed Mar 12 09:45:51 EST 2003
- Previous message (by thread): OOP in python
- Next message (by thread): OOP in python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> From: bobnotbob at byu.edu [mailto:bobnotbob at byu.edu] > Sent: Wednesday, March 12, 2003 8:41 AM > > What exactly do you inherit from another class in python? With no > type checking in python, the type doesn't matter, and the __init__() > function of the parent doesn't seem to be called (unless you > explicitly call it yourself). Does it inherit anything more than just > the member functions? > *EVERYTHING* is inherited. The thing is that parent class initializers are not automagically called, since their signature might be different from the child class' __init__. So, you have to explicitly call parent initializers from you own derived class, but it's no biggie. You might want to use new-style classes, by subclassing object. In those, you can call "super(MyClass,self).__init__(...)" to automatically call you class' superclass, no matter what it's name might be. HTH -gus
- Previous message (by thread): OOP in python
- Next message (by thread): OOP in python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list