Skip to content

Instantly share code, notes, and snippets.

@marc-harry
Created September 11, 2015 08:02
Show Gist options
  • Select an option

  • Save marc-harry/117d0c2b2b76b2af6ebb to your computer and use it in GitHub Desktop.

Select an option

Save marc-harry/117d0c2b2b76b2af6ebb to your computer and use it in GitHub Desktop.
Base Python Samples
class Greeting:
def __init__(self):
self.subName = 'SubName'
self.attr = []
def subMethod(self):
return 'SubMethod'
class Hello(Greeting):
name = ''
def __init__(self):
Greeting.__init__(self)
self.name = 'shared name'
self.actualName = 'each name'
self.attr.append(1)
def changeSub(self, random):
self.subName = random
def addAttr(self, att):
self.attr.append(att)
h = Hello()
p = Hello()
h.name = 'Test'
p.actualName = 'new name'
p.changeSub('new name')
h.addAttr(2)
print h.actualName + ' ' + h.name
print p.actualName + ' ' + h.name
print h.subName
print p.subName
print h.attr
print p.attr
print p.subMethod()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment