python-import-hell:嵌套导入重新导入的示例

时间:2021-05-22 15:36:31
【文件属性】:
文件名称:python-import-hell:嵌套导入重新导入的示例
文件大小:5KB
文件格式:ZIP
更新时间:2021-05-22 15:36:31
Python Python导入地狱 这提供了一个玩具示例,解释了如何导入到预先存在的名称空间而又不重新创建已经存在的模块对象。 该用例用于作为软件包一部分包含的自动生成的代码。 代码和导入 该软件包具有以下结构: foo/ __init__.py _generated/ __init__.py google/ baz.py bing.py __init__.py baz模块导入bing模块,但是(在自动生成的假设下)它通过 from google import bing 而不是绝对导入 from foo . _generated . google import bing 问题是什么? 当使用这样的代码时,用户代码可能会执行类似的操作 from foo . _genera
【文件预览】:
python-import-hell-master
----.gitignore(155B)
----import_tester.py(1KB)
----foo()
--------__init__.py(431B)
--------_generated()
----run_tester.sh(183B)
----README.md(2KB)
----run_tester_output.txt(4KB)

网友评论