File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 11.. _dynamic-typing :
22
3-
43Dynamically typed code
54======================
65
@@ -94,6 +93,8 @@ third party libraries that mypy does not know about. This is particularly the ca
9493when using the :option: `--ignore-missing-imports <mypy --ignore-missing-imports> `
9594flag. See :ref: `fix-missing-imports ` for more information about this.
9695
96+ .. _any-vs-object :
97+
9798Any vs. object
9899--------------
99100
Original file line number Diff line number Diff line change @@ -39,7 +39,10 @@ A value with the ``Any`` type is dynamically typed. Mypy doesn't know
3939anything about the possible runtime types of such value. Any
4040operations are permitted on the value, and the operations are only checked
4141at runtime. You can use ``Any `` as an "escape hatch" when you can't use
42- a more precise type for some reason.
42+ a more precise type for some reason. This should not be confused with the
43+ :py:class: `object ` type, which also represents any value, but in a type-safe
44+ way; it's almost always preferable to use ``object `` instead of ``Any ``, if
45+ you can do so without great difficulty — see :ref: `any-vs-object ` for more.
4346
4447``Any `` is compatible with every other type, and vice versa. You can freely
4548assign a value of type ``Any `` to a variable with a more precise type:
You can’t perform that action at this time.
0 commit comments