推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
liuchang0812
V2EX  ›  Python

分享自己写的文章:介绍关于 python import 的常见问题、实现与拓展

  •  
  •   liuchang0812 · Oct 25, 2015 · 4108 views
    This topic created in 3863 days ago, the information mentioned may be changed or developed.

    文章包含下面的内容:

    • python 引入机制

      1. 相对引入
      2. 完全引入
    • 一些实践经验

      1. 打包
      2. virtualenv
      3. 引入方式的选择
    • python import 的实现

      1. finder
      2. loader
      3. importer
      4. meta_path
      5. path_hook
    • python hook

      1. hook 实现方法
      2. hook 例子

    文章地址: https://github.com/Liuchang0812/slides/tree/master/pycon2015cn
    头条地址: http://toutiao.io/posts/um73rm

    8 replies    2015-10-26 21:57:28 +08:00
    freeandeasy
        1
    freeandeasy  
       Oct 25, 2015
    话说我昨天还是前天查 import 规范的时候貌似看到这篇文章了。
    jimmy66
        2
    jimmy66  
       Oct 25, 2015
    已 star ,收藏慢慢看
    mywaiting
        3
    mywaiting  
       Oct 25, 2015
    python import 的常见问题中竟然没有写循环 import 的问题,略差评啊
    lll9p
        4
    lll9p  
       Oct 25, 2015   ❤️ 1
    在之后的版本和 Python3 版本, *相对* 引用已经成为默认的引用方式。?
    liuchang0812
        5
    liuchang0812  
    OP
       Oct 25, 2015
    @lll9p 谢谢,已经修正
    liuchang0812
        6
    liuchang0812  
    OP
       Oct 25, 2015
    @mywaiting 对循环引用不是特别的清晰,平时自己碰到较少,就没有写。欢迎 PR ,帮着补全。
    adrianzhang
        7
    adrianzhang  
       Oct 25, 2015
    很用心的文章。
    Damnever
        8
    Damnever  
       Oct 26, 2015
    @liuchang0812

    关于循环引用,这个老社区里面还有些好东西 http://wiki.woodpecker.org.cn/moin/MiscItems/2008-11-25
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2838 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 14:55 · PVG 22:55 · LAX 07:55 · JFK 10:55
    ♥ Do have faith in what you're doing.