mirror of
https://github.com/python/cpython.git
synced 2025-01-19 15:05:15 +08:00
Issue #17907: Document types.ModuleType's constructor and attributes,
allowing for documenting imp.new_module() as deprecated.
This commit is contained in:
parent
05a647deed
commit
2d77204180
@ -112,6 +112,9 @@ This module provides an interface to the mechanisms used to implement the
|
||||
Return a new empty module object called *name*. This object is *not* inserted
|
||||
in ``sys.modules``.
|
||||
|
||||
.. deprecated:: 3.4
|
||||
Use :class:`types.ModuleType` instead.
|
||||
|
||||
|
||||
.. function:: reload(module)
|
||||
|
||||
|
@ -107,9 +107,35 @@ Standard names are defined for the following types:
|
||||
C".)
|
||||
|
||||
|
||||
.. data:: ModuleType
|
||||
.. class:: ModuleType(name, doc=None)
|
||||
|
||||
The type of modules.
|
||||
The type of :term:`modules <module>`. Constructor takes the name of the
|
||||
module to be created and optionally its :term:`docstring`.
|
||||
|
||||
.. attribute:: __doc__
|
||||
|
||||
The :term:`docstring` of the module. Defaults to ``None``.
|
||||
|
||||
.. attribute:: __loader__
|
||||
|
||||
The :term:`loader` which loaded the module. Defaults to ``None``.
|
||||
|
||||
.. versionchanged:: 3.4
|
||||
Defaults to ``None``. Previously the attribute was optional.
|
||||
|
||||
.. attribute:: __name__
|
||||
|
||||
The name of the module.
|
||||
|
||||
.. attribute:: __package__
|
||||
|
||||
Which :term:`package` a module belongs to. If the module is top-level
|
||||
(i.e. not a part of any specific package) then the attribute should be set
|
||||
to ``''``, else it should be set to the name of the package (which can be
|
||||
:attr:`__name__` if the module is a package itself). Defaults to ``None``.
|
||||
|
||||
.. versionchanged:: 3.4
|
||||
Defaults to ``None``. Previously the attribute was optional.
|
||||
|
||||
|
||||
.. data:: TracebackType
|
||||
|
Loading…
Reference in New Issue
Block a user