python的反射相比java更为简单
例子:
def fun1():
print ‘this is function 1’
def fun2():
print ‘this is function 2’
mylist = []
mylist.append(fun1)
mylist.append(fun2)
for one in mylist:
one()
输出为:
this is function 1
this is function 2
python的反射相比java更为简单
例子:
def fun1():
print ‘this is function 1’
def fun2():
print ‘this is function 2’
mylist = []
mylist.append(fun1)
mylist.append(fun2)
for one in mylist:
one()
输出为:
this is function 1
this is function 2