Question about inheritence

Jordan JordanNealBerg at
Tue Jul 22 18:39:42 CEST 2008

On Jul 22, 12:26 pm, Catherine Heathcote
<catherine.heathc... at> wrote:
> If I create a new class inherited from another with a constructor, what
> happens with the new class's constructer?
> Thanks for your time.

Well, the __init__ method of the subclass is called, and from within
it you can call the superclass constructor.

Here is a sample code:

class A():
     def __init__(self, bla):
            #do some stuff here

class B(A):
     def __init__(self, bla2):
          #do some stuff here

More information about the Python-list mailing list