diff options
author | Ivan Levkivskyi <levkivskyi@gmail.com> | 2017-12-14 10:59:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-14 10:59:44 (GMT) |
commit | 5364b5cd7571f2dfa75acd37b388c14ac33fef73 (patch) | |
tree | 43b89bf162a571e979946d2d9dcfda82b4e0f4c8 /Doc/whatsnew/3.7.rst | |
parent | 9e7c136ad8bc8e8eec50c2a8ae5ff02752f695a2 (diff) | |
download | cpython-5364b5cd7571f2dfa75acd37b388c14ac33fef73.zip cpython-5364b5cd7571f2dfa75acd37b388c14ac33fef73.tar.gz cpython-5364b5cd7571f2dfa75acd37b388c14ac33fef73.tar.bz2 |
bpo-32225: Implementation of PEP 562 (#4731)
Implement PEP 562: module __getattr__ and __dir__.
The implementation simply updates module_getattro and
module_dir.
Diffstat (limited to 'Doc/whatsnew/3.7.rst')
-rw-r--r-- | Doc/whatsnew/3.7.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index d6d0861..3574b53 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -159,6 +159,24 @@ effort will be made to add such support. PEP written by Erik M. Bray; implementation by Masayuki Yamamoto. +PEP 562: Customization of access to module attributes +----------------------------------------------------- + +It is sometimes convenient to customize or otherwise have control over access +to module attributes. A typical example is managing deprecation warnings. +Typical workarounds are assigning ``__class__`` of a module object to +a custom subclass of :class:`types.ModuleType` or replacing the ``sys.modules`` +item with a custom wrapper instance. This procedure is now simplified by +recognizing ``__getattr__`` defined directly in a module that would act like +a normal ``__getattr__`` method, except that it will be defined on module +*instances*. + +.. seealso:: + + :pep:`562` -- Module ``__getattr__`` and ``__dir__`` + PEP written and implemented by Ivan Levkivskyi + + PEP 564: Add new time functions with nanosecond resolution ---------------------------------------------------------- |