前言
提示:这里可以添加本文要记录的大概内容:
“most likely due to a circular import”翻译为“很可能是由于循环导入”,提示 ImportError,在对自定义模块的引用中出现。Python 学习手册《编程常见问题》对“How can I have modules that mutually import each other?”的回答解决了这个问题。本文是对这一内容的抄录和整理。
提示:以下是本篇文章正文内容,下面案例可供参考
1 示例
如下示例来自学习手册:
2 解释器的操作步骤
3 错误分析
对上述操作步骤的错误分析:
- The last step fails, because Python isn’t done with interpreting foo yet and the global symbol dictionary for foo is still empty.
最后一步失败了,因