class types.ModuleType(name, doc=None)
The type of modules. Constructor takes the name of the module to be created and optionally its docstring.
Note
Use importlib.util.module_from_spec()
to create a new module if you wish to set the various import-controlled attributes.
-
__doc__
-
The docstring of the module. Defaults to
None
.
-
__loader__
-
The loader which loaded the module. Defaults to
None
.Changed in version 3.4: Defaults to
None
. Previously the attribute was optional.
-
__name__
-
The name of the module.
-
__package__
-
Which 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__name__
if the module is a package itself). Defaults toNone
.Changed in version 3.4: Defaults to
None
. Previously the attribute was optional.
Please login to continue.