Newbie inheritance question.

Just just at xs4all.nl
Sun Jan 16 10:35:20 EST 2005


In article <mailman.763.1105885462.22381.python-list at python.org>,
 Ed Leafe <ed at leafe.com> wrote:

> On Jan 16, 2005, at 9:08 AM, bwobbones wrote:
> 
> > class two(one):
> >    def __init__(self):
> >        print "two"
> 
> 	You need to specifically call the superclass's __init__ here in order 
> for it to fire. Just add the line
> 
>         super(two, self).__init__()
> 
> as the first line of the subclass's __init__.

super() only works for new-style classes, ie. class one needs to derive 
from object for this to work.

Just



More information about the Python-list mailing list