You did:

>>> class BaseHandler:
...     def foo(self):
...             print "Hello"
...
>>> class HomerHandler(BaseHandler):
...     pass
...
>>> test = HomerHandler()
>>> test.foo()
Hello
>>> isinstance(test, BaseHandler)
True
>>> isinstance(test, HomerHandler)
True
>>>

You could say test is a "BaseHandler of type HomerHandler"



2011/4/21 chad <cdal...@gmail.com>

> Let's say I have the following....
>
> class BaseHandler:
>    def foo(self):
>        print "Hello"
>
> class HomeHandler(BaseHandler):
>    pass
>
>
> Then I do the following...
>
> test = HomeHandler()
> test.foo()
>
> How can HomeHandler call foo() when I never created an instance of
> BaseHandler?
>
> Chad
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to