A question about Python Classes
Kyle T. Jones
onexpadREMOVE at EVOMERyahoodotyouknow.com
Fri Apr 22 15:49:07 CEST 2011
Ethan Furman wrote:
> chad wrote:
>> 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.
Really? That's not at all how I thought it worked in Python
(post-instantiation referencing of class and superclass code...)
More information about the Python-list