@@ -184,14 +184,16 @@ defined by three rules:
184184 subtype of ``t2``. (But not the other way around.)
185185- ``Any`` is consistent with every type. (But ``Any`` is not a subtype
186186 of every type.)
187- - Every type is a subtype of ``Any``. (Which also makes every type
188- consistent with ``Any``, via rule 1 .)
187+ - Every type is consistent with ``Any``. (But every type is not a subtype
188+ of ``Any``.)
189189
190190That's all! See Jeremy Siek's blog post `What is Gradual
191191Typing <http://wphomes.soic.indiana.edu/jsiek/what-is-gradual-typing/>`_
192- for a longer explanation and motivation. Note that rule 3 places ``Any``
193- at the root of the type graph. This makes it very similar to
194- ``object``. The difference is that ``object`` is not consistent with
192+ for a longer explanation and motivation. ``Any`` can be considered a type
193+ that has all values and all methods. Combined with the definition of
194+ subtyping above, this places ``Any`` partially at the top (it has all values)
195+ and bottom (it has all methods) of the type hierarchy. Contrast this to
196+ ``object`` -- it is not consistent with
195197most types (e.g. you can't use an ``object()`` instance where an
196198``int`` is expected). IOW both ``Any`` and ``object`` mean
197199"any type is allowed" when used to annotate an argument, but only ``Any``
@@ -269,14 +271,14 @@ between classes and types the following general rules apply:
269271- No types defined below can be subclassed, except for ``Generic`` and
270272 classes derived from it.
271273- All of these will raise ``TypeError`` if they appear
272- in ``isinstance`` or ``issubclass``.
274+ in ``isinstance`` or ``issubclass`` (except for unparametrized generics) .
273275
274276
275277Fundamental building blocks
276278---------------------------
277279
278- - **Any**. Every type is a subtype of ``Any``; however, to the static
279- type checker it is also consistent with every type (see above).
280+ - **Any**. Every type is consistent with ``Any``; and
281+ it is also consistent with every type (see above).
280282- **Union[t1, t2, ...]**. Types that are subtype of at least one of
281283 ``t1`` etc. are subtypes of this.
282284
@@ -292,9 +294,7 @@ Fundamental building blocks
292294 Example: ``Union[Employee, Manager] == Union[Employee]``.
293295 * ``Union[t1]`` returns just ``t1``. ``Union[]`` is illegal,
294296 so is ``Union[()]``
295- * Corollary: ``Union[..., Any, ...]`` returns ``Any``;
296- ``Union[..., object, ...]`` returns ``object``; to cut a
297- tie, ``Union[Any, object] == Union[object, Any] == Any``.
297+ * Corollary: ``Union[..., object, ...]`` returns ``object``.
298298
299299- **Optional[t1]**. Alias for ``Union[t1, None]``, i.e. ``Union[t1,
300300 type(None)]``.
0 commit comments