From 8190ba0c80e74308223fa4adf07db3c3edbe5efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Sat, 25 May 2013 16:12:02 +0200 Subject: [PATCH] Include an example output from _compose_mro() --- pep-0443.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pep-0443.txt b/pep-0443.txt index df758321a..d7f69ed9d 100644 --- a/pep-0443.txt +++ b/pep-0443.txt @@ -190,6 +190,19 @@ argument which includes the relevant ABCs. The algorithm is as follows:: mro.insert(index, regcls) return mro +In its most basic form, it returns the MRO for the given type:: + +>>> _compose_mro(dict, []) +[, ] + +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]) +[, , + , , + ] + 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