summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-03-31 19:26:24 (GMT)
committerGeorg Brandl <georg@python.org>2009-03-31 19:26:24 (GMT)
commit956ed9782ab887fa66b02876f315e922c17409d3 (patch)
treecea67bedfffe4db8084b5a4397d46dd16943422d
parent2ce1c61ca6c813e68231b0554a7e6180d8114bed (diff)
downloadcpython-956ed9782ab887fa66b02876f315e922c17409d3.zip
cpython-956ed9782ab887fa66b02876f315e922c17409d3.tar.gz
cpython-956ed9782ab887fa66b02876f315e922c17409d3.tar.bz2
#4411: document mro() and __mro__. (I hope I got it right.)
-rw-r--r--Doc/library/stdtypes.rst17
1 files changed, 16 insertions, 1 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 2e54039..03565b0 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -2675,9 +2675,24 @@ types, where they are relevant. Some of these are not reported by the
The name of the class or type.
+The following attributes are only supported by :term:`new-style class`\ es.
+
+.. attribute:: class.__mro__
+
+ This attribute is a tuple of classes that are considered when looking for
+ base classes during method resolution.
+
+
+.. method:: class.mro()
+
+ This method can be overridden by a metaclass to customize the method
+ resolution order for its instances. It is called at class instantiation, and
+ its result is stored in :attr:`__mro__`.
+
+
.. method:: class.__subclasses__
- :term:`New-style class`\ es keep a list of weak references to their immediate
+ Each new-style class keeps a list of weak references to its immediate
subclasses. This method returns a list of all those references still alive.
Example::