[Python-checkins] peps: Include an example output from _compose_mro()

lukasz.langa python-checkins at python.org
Sat May 25 16:12:20 CEST 2013


http://hg.python.org/peps/rev/b68e55e3c815
changeset:   4909:b68e55e3c815
user:        Łukasz Langa <lukasz at langa.pl>
date:        Sat May 25 16:12:02 2013 +0200
summary:
  Include an example output from _compose_mro()

files:
  pep-0443.txt |  13 +++++++++++++
  1 files changed, 13 insertions(+), 0 deletions(-)


diff --git a/pep-0443.txt b/pep-0443.txt
--- a/pep-0443.txt
+++ b/pep-0443.txt
@@ -190,6 +190,19 @@
           mro.insert(index, regcls)
       return mro
 
+In its most basic form, it returns the MRO for the given type::
+
+>>> _compose_mro(dict, [])
+[<class 'dict'>, <class 'object'>]
+
+When the haystack consists of ABCs that the specified type is a subclass
+of, they are inserted in a predictable order::
+
+>>> _compose_mro(dict, [Sized, MutableMapping, str, Sequence, Iterable])
+[<class 'dict'>, <class 'collections.abc.MutableMapping'>,
+ <class 'collections.abc.Iterable'>, <class 'collections.abc.Sized'>,
+ <class 'object'>]
+
 While this mode of operation is significantly slower, no caching is
 involved because user code may ``register()`` a new class on an ABC at
 any time. In such case, it is possible to create a situation with

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


More information about the Python-checkins mailing list