A question about Python Classes
ethan at stoneleaf.us
Thu Apr 21 14:34:49 EDT 2011
> Let's say I have the following....
> class BaseHandler:
> def foo(self):
> print "Hello"
> class HomeHandler(BaseHandler):
> Then I do the following...
> test = HomeHandler()
> How can HomeHandler call foo() when I never created an instance of
You don't need to create an instance of BaseHandler. You have the
class, Python knows you have the class -- Python will look there if the
subclasses lack an attribute.
More information about the Python-list