class myTest:
def __init__(self):
self.doSubs = [{'func':self.shout}, {'func':self.say}]
#self.doSub = self.shout
def shout(self, text = 'Good', name = 'day'):
return text.upper() + ', ' + name
def say(self, text = "hi"):
return text.upper()
# def doRun(self):
# print(self.doSub('Hello', 'andy'))
def doRun(self):
for job in self.doSubs:
print(job['func']())
#print(job['func']('Hello', 'andy'))
test = myTest()
#print( test.shout('hello', 'andy') )
#yell = shout
test.doRun()
#print(yell('Hello', 'andy'))
沒有留言:
張貼留言