次の例を検討してください。
import types
methods = ['foo', 'bar']
def metaMethod(self):
print "method", "<name>"
class Egg:
def __init__(self):
for m in methods:
self.__dict__[m] = types.MethodType(metaMethod, self)
e = Egg()
e.foo()
e.bar()
の代わりに何を書けばいい"<name>"
ので、出力は
method foo
method bar