Python动态展现之一

首先:

def f():
    print('first')

def g():
    f()

g()

def f():
    print('second')

g()

结果:

>>> 
first
second

 

又来:

def g():
    f()

g()

def f():
    print('second')

g()

结果:

NameError: global name 'f' is not defined

 

再来:

def g():
    f()


def f():
    print('second')

g()

结果:

>>> 
second

 

posted @ 2013-11-06 21:23  LisPythoniC  阅读(209)  评论(0编辑  收藏  举报