[Python-checkins] cpython: add whatsnew entry for PEP 421

eric.snow python-checkins at python.org
Thu Sep 6 07:21:53 CEST 2012


http://hg.python.org/cpython/rev/30ce5a944c7d
changeset:   78858:30ce5a944c7d
user:        Eric Snow <ericsnowcurrently at gmail.com>
date:        Wed Sep 05 22:19:38 2012 -0700
summary:
  add whatsnew entry for PEP 421

files:
  Doc/whatsnew/3.3.rst |  35 ++++++++++++++++++++++++++++++++
  1 files changed, 35 insertions(+), 0 deletions(-)


diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -564,6 +564,41 @@
 or amends calling signatures or arguments.
 
 
+PEP 421: Adding sys.implementation
+==================================
+
+:pep:`421` - Adding sys.implementation
+ PEP written and implemented by Eric Snow.
+
+A new attribute on the :mod:`sys` module exposes details specific to the
+implementation of the currently running interpreter.  The initial set of
+attributes on :attr:`sys.implementation` are ``name``, ``version``,
+``hexversion``, and ``cache_tag``.
+
+The intention of ``sys.implementation`` is to consolidate into one namespace
+the implementation-specific data used by the standard library.  This allows
+different Python implementations to share a single standard library code base
+much more easily.  In its initial state, ``sys.implementation`` holds only a
+small portion of the implementation-specific data.  Over time that ratio will
+shift in order to make the standard library more portable.
+
+One example of improved standard library portability is ``cache_tag``.  As of
+Python 3.3, ``sys.implementation.cache_tag`` is used by :mod:`importlib` to
+support :pep:`3147` compliance.  Any Python implementation that uses
+``importlib`` for its built-in import system may use ``cache_tag`` to control
+the caching behavior for modules.
+
+SimpleNamespace
+---------------
+
+The implementation of ``sys.implementation`` also introduces a new type to
+Python: :class:`types.SimpleNamespace`.  In contrast to a mapping-based
+namespace, like :class:`dict`, ``SimpleNamespace`` is attribute-based, like
+:class:`object`.  However, unlike ``object``, ``SimpleNamespace`` instances
+are writable.  This means that you can add, remove, and modify the namespace
+through normal attribute access.
+
+
 .. _importlib:
 
 Using importlib as the Implementation of Import

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list