Skip to content

Instantly share code, notes, and snippets.

@dsmith
Created December 16, 2013 00:32
Show Gist options
  • Save dsmith/7980516 to your computer and use it in GitHub Desktop.
Save dsmith/7980516 to your computer and use it in GitHub Desktop.
class A():
def __init__(self):
self._things = {
'thing_one': 10,
'thing_two': 10,
}
def get_thing(self, key):
return self._things[key]
def things(self):
return self._things.keys()
class B(A):
def __init__(self):
self._things = {
'thing_one': 20,
'thing_two': 10,
}
a = A()
b = B()
print 'All the things', a.things()
print 'A.thing_one', a.get_thing('thing_one')
print 'A.thing_two', a.get_thing('thing_two')
print 'B.thing_one', b.get_thing('thing_one')
print 'B.thing_two', b.get_thing('thing_two')
print 'B.thing_two', b.get_thing('thing_two')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment