@@ -1857,11 +1857,27 @@ passed through to all metaclass operations described below.
18571857
18581858When a class definition is executed, the following steps occur:
18591859
1860+ * MRO entries are resolved
18601861* the appropriate metaclass is determined
18611862* the class namespace is prepared
18621863* the class body is executed
18631864* the class object is created
18641865
1866+
1867+ Resolving MRO entries
1868+ ^^^^^^^^^^^^^^^^^^^^^
1869+
1870+ If a base that appears in class definition is not an instance of :class: `type `,
1871+ then an ``__mro_entries__ `` method is searched on it. If found, it is called
1872+ with the original bases tuple. This method must return a tuple of classes that
1873+ will be used instead of this base. The tuple may be empty, in such case
1874+ the original base is ignored.
1875+
1876+ .. seealso ::
1877+
1878+ :pep: `560 ` - Core support for typing module and generic types
1879+
1880+
18651881Determining the appropriate metaclass
18661882^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18671883.. index ::
@@ -2061,6 +2077,27 @@ case the instance is itself a class.
20612077 module) to the language.
20622078
20632079
2080+ Emulating generic types
2081+ -----------------------
2082+
2083+ One can implement the generic class syntax as specified by :pep: `484 `
2084+ (for example ``List[int] ``) by defining a special method
2085+
2086+ .. classmethod :: object.__class_getitem__(cls, key)
2087+
2088+ Return an object representing the specialization of a generic class
2089+ by type arguments found in *key *.
2090+
2091+ This method is looked up on the class object itself, and when defined in
2092+ the class body, this method is implicitly a class method. Note, this
2093+ mechanism is primarily reserved for use with static type hints, other usage
2094+ is discouraged.
2095+
2096+ .. seealso ::
2097+
2098+ :pep: `560 ` - Core support for typing module and generic types
2099+
2100+
20642101.. _callable-types :
20652102
20662103Emulating callable objects
0 commit comments