Skip to content

Instantly share code, notes, and snippets.

@tkf
Created July 15, 2010 17:46
Show Gist options
  • Select an option

  • Save tkf/477256 to your computer and use it in GitHub Desktop.

Select an option

Save tkf/477256 to your computer and use it in GitHub Desktop.
class MyClass(object):
def m1(self): print 1
def m2(self): print 2
def m3(self): print 3
ms1 = [m1, m2, m3]
def __init__(self):
self.ms2 = [self.m1, self.m2, self.m3]
def callall(self):
for m in self.ms1:
m(self)
for m in self.ms2:
m()
c = MyClass()
c.callall()
1
2
3
1
2
3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment