summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-02-25 21:03:14 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-02-25 21:03:14 (GMT)
commit13cc883aaa69b61416c5f7c3f216d258d46040d9 (patch)
tree33234d37f282839464c5f0e32641f9abb9be3284 /Doc/library
parent1e923de0bf9d222f8f389a4649520384bb4be015 (diff)
downloadcpython-13cc883aaa69b61416c5f7c3f216d258d46040d9.zip
cpython-13cc883aaa69b61416c5f7c3f216d258d46040d9.tar.gz
cpython-13cc883aaa69b61416c5f7c3f216d258d46040d9.tar.bz2
whatsnew: DynanicClassAttribute (#19030), Py_SetStandardStreamEncoding (#16129)
Adding missing docs for DynamicClassAttribute by copying the docstring. The doc entry could stand some expansion, which I will note on the issue.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/types.rst21
1 files changed, 21 insertions, 0 deletions
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index c4f57e4..abdb939 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -15,6 +15,9 @@ It also defines names for some object types that are used by the standard
Python interpreter, but not exposed as builtins like :class:`int` or
:class:`str` are.
+Finally, it provides some additional type-related utility classes and functions
+that are not fundamental enough to be builtins.
+
Dynamic Type Creation
---------------------
@@ -220,6 +223,9 @@ Standard names are defined for the following types:
Return a new view of the underlying mapping's values.
+Additional Utility Classes and Functions
+----------------------------------------
+
.. class:: SimpleNamespace
A simple :class:`object` subclass that provides attribute access to its
@@ -246,3 +252,18 @@ Standard names are defined for the following types:
instead.
.. versionadded:: 3.3
+
+
+.. function:: DynamicClassAttribute(fget=None, fset=None, fdel=None, doc=None)
+
+ Route attribute access on a class to __getattr__.
+
+ This is a descriptor, used to define attributes that act differently when
+ accessed through an instance and through a class. Instance access remains
+ normal, but access to an attribute through a class will be routed to the
+ class's __getattr__ method; this is done by raising AttributeError.
+
+ This allows one to have properties active on an instance, and have virtual
+ attributes on the class with the same name (see Enum for an example).
+
+ .. versionadded:: 3.4