diff --git a/pep-0484.txt b/pep-0484.txt index de010de78..1c73c52ed 100644 --- a/pep-0484.txt +++ b/pep-0484.txt @@ -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:: @@ -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 =========