Skip to content

Instantly share code, notes, and snippets.

@datamafia
Created February 22, 2015 18:37
Show Gist options
  • Save datamafia/a42e47ee1b97229c92ec to your computer and use it in GitHub Desktop.
Save datamafia/a42e47ee1b97229c92ec to your computer and use it in GitHub Desktop.
Minimal proto for subclass in Python (social media)
#!/usr/bin/env python
class A(object):
var = 'A'
def __init__(self):
self.test()
def test(self):
print 'Class A: '+self.var
class B(A):
def __init__(self):
super(A, self).__init__()
self.test()
def test(self):
print 'Class B: '+self.var
a= A() # Class A: A
b= B() # Class B: A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment