【发布时间】:2011-11-02 14:36:31
【问题描述】:
可能重复:
Should Python import statements always be at the top of a module?
在一个非常简单的单文件python程序中
# ------------------------
# place 1
# import something
def foo():
# place 2
# import something
return something.foo()
def bar(f):
...
def baz():
f = foo()
bar(f)
baz()
# ----------------
你会把“import something”放在第 1 位还是第 2 位?
【问题讨论】:
标签: python