Thanks to visit codestin.com
Credit goes to github.com

Skip to content

语句重复 #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions source/c10/p05_separate_directories_import_by_namespace.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
----------
在这里工作的机制被称为“包命名空间”的一个特征。从本质上讲,包命名空间是一种特殊的封装设计,为合并不同的目录的代码到一个共同的命名空间。对于大的框架,这可能是有用的,因为它允许一个框架的部分被单独地安装下载。它也使人们能够轻松地将第三方附加组件和其他扩展到这样的框架中。


在这里工作的机制被称为“包命名空间”的一个特征。从本质上讲,包命名空间是一种特殊的封装设计,为合并不同的目录的代码到一个共同的命名空间。对于大的框架,这可能是有用的,因为它允许一个框架的部分被单独地安装下载。它也使人们能够轻松地将第三方附加组件和其他扩展到这样的框架中。包命名空间的关键是确保顶级目录没有__init__.py文件来作为共同的命名空间。缺失__init__.py文件在导入包的时候会有有趣的事情发生。特殊的包命名空间模块被创建,只读的目录列表副本被存储在其__path__变量中。
包命名空间的关键是确保顶级目录没有__init__.py文件来作为共同的命名空间。缺失__init__.py文件在导入包的时候会有有趣的事情发生。特殊的包命名空间模块被创建,只读的目录列表副本被存储在其__path__变量中。
举个例子:

.. code-block:: python
Expand Down