<p><br>
On Apr 21, 2011 12:55 PM, "chad" <<a href="mailto:cdalten@gmail.com">cdalten@gmail.com</a>> wrote:<br>
><br>
> On Apr 21, 9:30 am, Jean-Michel Pichavant <<a href="mailto:jeanmic...@sequans.com">jeanmic...@sequans.com</a>><br>
> wrote:<br>
> > chad wrote:<br>
> > > Let's say I have the following....<br>
> ><br>
> > > class BaseHandler:<br>
> > >     def foo(self):<br>
> > >         print "Hello"<br>
> ><br>
> > > class HomeHandler(BaseHandler):<br>
> > >     pass<br>
> ><br>
> > > Then I do the following...<br>
> ><br>
> > > test = HomeHandler()<br>
> > > test.foo()<br>
> ><br>
> > > How can HomeHandler call foo() when I never created an instance of<br>
> > > BaseHandler?<br>
> ><br>
> > > Chad<br>
> ><br>
> > you did, test is an instance of BaseHandler.<br>
> ><br>
> >  > isinstance(test, HomeHandler)<br>
> > < True<br>
> ><br>
> >  > isinstance(test, BaseHandler)<br>
> > < True<br>
> ><br>
><br>
> So it just just creates an instance of every class that it inherits?<br>
><br>
> Chad<br></p>
<p>No. it is an instance of every class it inherits. It's called inheritance because it inherits the attributes and methods of the parent class<br>
> --<br>
> <a href="http://mail.python.org/mailman/listinfo/python-list">http://mail.python.org/mailman/listinfo/python-list</a><br>
</p>