Difference between memory usage when importing modules

∥☆過路亽.° 提交于 2019-12-07 03:22:39

The first uses the least memory since it only creates a single name in the module scope.

The second uses the most (assuming Mod1 contains more than just a, b, and c either explicitly or in __all__) since all names are recreated.

In all three cases the entire module is imported and executed, so if you're looking for large memory savings this is not what you want to optimize.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!