Invoke a superclass method from a subclass constructor

Prasad, Ramit ramit.prasad at
Tue Sep 13 18:24:10 CEST 2011

Written by Kayode Odeyemi
Well, I did try using super(), but I got this:
>>> class B(A):
...     def __init__(self, module):
...             super(A, self).log('system')
>>> c = B('module')
You should be passed super the current class you want the super class of, not the type of the super class. So it should be:
super(B, self).log('system') # Notice that it passed class B


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list