Include an example output from _compose_mro()
This commit is contained in:
parent
cab76cf1f0
commit
8190ba0c80
13
pep-0443.txt
13
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, [])
|
||||
[<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
|
||||
|
|
Loading…
Reference in New Issue