Adding missing docs for DynamicClassAttribute by copying the docstring. The doc entry could stand some expansion, which I will note on the issue.
This commit is contained in:
parent
1e923de0bf
commit
13cc883aaa
|
@ -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
|
||||
|
|
|
@ -1270,6 +1270,17 @@ reducing the amount of memory consumed. (Contributed by Andrew Kuchling in
|
|||
:issue:`1565525`).
|
||||
|
||||
|
||||
types
|
||||
-----
|
||||
|
||||
A new :func:`~types.DynamicClassAttribute` descriptor provides a way to define
|
||||
an attribute that acts normally when looked up through an instance object, but
|
||||
which is routed to the *class* ``__getattr__`` when looked up through the
|
||||
class. This allows one to have properties active on a class, and have virtual
|
||||
attributes on the class with the same name (see :mod:`Enum` for an example).
|
||||
(Contributed by Ethan Furman in :issue:`19030`.)
|
||||
|
||||
|
||||
urllib
|
||||
------
|
||||
|
||||
|
@ -1512,6 +1523,12 @@ Other Build and C API Changes
|
|||
object allocator have been silenced. (Contributed by Dhiru Kholia in
|
||||
:issue:`18596`.)
|
||||
|
||||
* New function :c:func:`Py_SetStandardStreamEncoding` allows an application
|
||||
that is embedding Python to do the equivalent of setting
|
||||
:envvar:`PYTHONIOENCODING`. Its arguments override the equivalent
|
||||
values from :envvar:`PYTHONIOENCODING` if it exists. (Contributed
|
||||
by Bastien Montagne and Nick Coghlan in :issue:`16129`.)
|
||||
|
||||
|
||||
.. _other-improvements-3.4:
|
||||
|
||||
|
|
Loading…
Reference in New Issue