When python does import, does it import names in 'import' statement? -
i don't have clear understanding of python's import mechanism. 1 thing confuses me is: when python imports module, imports names imported there. here code:
# a.py def a_func(): pass; # b.py import *; def b_func(): pass; # c.py b import *; def c_func(): # can use b_func, ok, no problem. # can use a_func here, import recursive?
if python recursively imports, code bad pratice? happens if add
from import *;
to c.py? cause overhead importing twice? or should avoid 'from xx import *' , import needed name?
thanks!
code executed first time import
called module. subsequent imports copy names , references.
having said that, don't import *
.
Comments
Post a Comment