Invoke a superclass method from a subclass constructor

Prasad, Ramit ramit.prasad at jpmorgan.com
Tue Sep 13 18:46:08 CEST 2011


>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

Ugh, apologies for the poor English; my tea has not kicked in.

That first line would be more understandable as:  'You should pass the current class (B) you want the super class of, not the type of the super class (A) itself. So it should be:'

To clarify, by passing A to super it retrieves the definition for the base class (object) which does not have the function you are trying to access.

Ramit


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 http://www.jpmorgan.com/pages/disclosures/email.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110913/7b64c35b/attachment.html>


More information about the Python-list mailing list