擅长:python、mysql、java
<p>“惰性导入”可以构建在<a href="http://www.python.org/dev/peps/pep-0302/" rel="nofollow noreferrer">PEP 302</a>中指定的“导入挂钩”之上,现在可以完全实现。PEP 369过去用于覆盖“惰性导入”和导入后挂钩,但后来被简化,现在只覆盖导入后挂钩;不过,您可能对<a href="http://permalink.gmane.org/gmane.comp.python.devel/90949" rel="nofollow noreferrer">original draft</a>感兴趣。</p>
<p>通过<code>meta_path</code>钩子可以在<a href="http://code.activestate.com/recipes/473888/" rel="nofollow noreferrer">this recipe</a>中找到一个很好的“惰性导入”实现。</p>