This is a different instance, but you defined links as a class variable, not an instance variable.
An instance variable will be defined as such:
class House(object):
Note that in Python, unlike other languages, an instance variable is explicitly declared as an instance property. This usually happens in the __init__ method to ensure that each instance has a variable.
Then the subclass will look like this:
class Villa(House): def __init__(self): super(Villa, self).__init__()
And code execution gives the correct results:
>>> house = House() >>> villa = Villa() >>> link = Link() >>> house.links.append(link) >>> print house.links [<__main__.Link instance at 0xcbaa8>] >>> print villa.links []
source share