标签:call ast efi pycha 函数 name trace erro err
即函数调用在函数定义之前
可以这样
def bbb():
print(‘this is b‘)
aaa()
def aaa():
print(‘this is a‘)
bbb()
--------->
this is b
this is a
可以这样
def aaa():
print(‘this is a‘)
def bbb():
print(‘this is b‘)
aaa()
bbb()
----------->
this is b
this is a
但不可以这样
def bbb():
print(‘this is b‘)
aaa()
bbb()
def aaa():
print(‘this is a‘)
--------->
Traceback (most recent call last):
this is b
File "E:/pycharm/TEST.py", line 600, in <module>
bbb()
File "E:/pycharm/TEST.py", line 599, in bbb
aaa()
NameError: name ‘aaa‘ is not defined
标签:call ast efi pycha 函数 name trace erro err
原文地址:http://www.cnblogs.com/lcgsmile/p/6128597.html