Skip to content

Commit

Permalink
PEP 484: Clarify that submodules in a package are exported (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored and gvanrossum committed Jul 17, 2017
1 parent f09b893 commit 7221386
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pep-0484.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,19 @@ Additional notes on stub files:
exported. (This makes it easier to re-export all objects from a
given module that may vary by Python version.)

* Just like in normal Python files [importdocs]_, submodules
automatically become exported attributes of their parent module
when imported. For example, if the ``spam`` package has the
following directory structure::

spam/
__init__.pyi
ham.pyi

where ``__init__.pyi`` contains a line such as ``from . import ham``
or ``from .ham import Ham``, then ``ham`` is an exported attribute
of ``spam``.

* Stub files may be incomplete. To make type checkers aware of this, the file
can contain the following code::

Expand Down Expand Up @@ -2457,6 +2470,9 @@ References
.. [peps]
https://hg.python.org/peps/file/tip/pep-0484.txt

.. [importdocs]
https://docs.python.org/3/reference/import.html#submodules


Copyright
=========
Expand Down

0 comments on commit 7221386

Please sign in to comment.