推荐学习书目
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
zungmou
V2EX  ›  Python

Python 用 from ... import ... 导入的问题

  •  
  •   zungmou · Dec 22, 2016 · 2448 views
    This topic created in 3455 days ago, the information mentioned may be changed or developed.
    在任意一个模块中,用 from ... import ... 导入的成员,当模块被其它地方引用时,用 from ... import ... 会暴露原始类 from import 的成员,有什么办法限制吗?

    __all__ 对这个情况无效。
    2 replies    2016-12-22 17:27:43 +08:00
    guyskk
        1
    guyskk  
       Dec 22, 2016 via Android   ❤️ 1
    del 可以
    PyHub
        2
    PyHub  
       Dec 22, 2016
    变量名前加一个下划线可以避免被`import`
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1434 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 16:59 · PVG 00:59 · LAX 09:59 · JFK 12:59
    ♥ Do have faith in what you're doing.