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

Skip to content

Commit 85527cf

Browse files
csabellancoghlan
authored andcommitted
bpo-27505: Add change notes in module attribute docs (GH-5320)
Make it clear that setting __class__ on a module has worked since 3.5, but support for __getattr__ and __dir__ on module instances requires 3.7+ Patch by Cheryl Sabella.
1 parent 37420de commit 85527cf

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Doc/reference/datamodel.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,6 +1564,17 @@ a module object to a subclass of :class:`types.ModuleType`. For example::
15641564
the module globals (whether by code within the module, or via a reference
15651565
to the module's globals dictionary) is unaffected.
15661566

1567+
.. versionchanged:: 3.5
1568+
``__class__`` module attribute is now writable.
1569+
1570+
.. versionadded:: 3.7
1571+
``__getattr__`` and ``__dir__`` module attributes.
1572+
1573+
.. seealso::
1574+
1575+
:pep:`562` - Module __getattr__ and __dir__
1576+
Describes the ``__getattr__`` and ``__dir__`` functions on modules.
1577+
15671578

15681579
.. _descriptors:
15691580

0 commit comments

Comments
 (0)