From af89a8cd81c456f8e7823da36a5701b65e639a4b Mon Sep 17 00:00:00 2001 From: GeoffreyOnRails Date: Thu, 9 Oct 2025 14:49:02 +0200 Subject: [PATCH 1/3] Adding missing reveal_type imports in cheat_sheet_py3.rst --- docs/source/cheat_sheet_py3.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/cheat_sheet_py3.rst b/docs/source/cheat_sheet_py3.rst index 7385a66863bf6..9954568572144 100644 --- a/docs/source/cheat_sheet_py3.rst +++ b/docs/source/cheat_sheet_py3.rst @@ -89,7 +89,7 @@ Functions .. code-block:: python from collections.abc import Iterator, Callable - from typing import Union, Optional + from typing import Union, Optional, reveal_type # This is how you annotate a function definition def stringify(num: int) -> str: @@ -222,7 +222,7 @@ When you're puzzled or when things are complicated .. code-block:: python - from typing import Union, Any, Optional, TYPE_CHECKING, cast + from typing import Union, Any, Optional, TYPE_CHECKING, cast, reveal_type # To find out what type mypy infers for an expression anywhere in # your program, wrap it in reveal_type(). Mypy will print an error From 26192cf8abe15b0b3c9a26c9cca8b02f1202411a Mon Sep 17 00:00:00 2001 From: GeoffreyOnRails Date: Tue, 14 Oct 2025 18:17:44 +0200 Subject: [PATCH 2/3] Modifying comment instead --- docs/source/cheat_sheet_py3.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/source/cheat_sheet_py3.rst b/docs/source/cheat_sheet_py3.rst index 9954568572144..2355e4ba239f2 100644 --- a/docs/source/cheat_sheet_py3.rst +++ b/docs/source/cheat_sheet_py3.rst @@ -89,7 +89,7 @@ Functions .. code-block:: python from collections.abc import Iterator, Callable - from typing import Union, Optional, reveal_type + from typing import Union, Optional # This is how you annotate a function definition def stringify(num: int) -> str: @@ -222,11 +222,12 @@ When you're puzzled or when things are complicated .. code-block:: python - from typing import Union, Any, Optional, TYPE_CHECKING, cast, reveal_type + from typing import Union, Any, Optional, TYPE_CHECKING, cast # To find out what type mypy infers for an expression anywhere in # your program, wrap it in reveal_type(). Mypy will print an error - # message with the type; remove it again before running the code. + # message with the type; remove it again before running the code, or + # import reveal_type from typing_extensions or typing (on Python 3.11 and newer) reveal_type(1) # Revealed type is "builtins.int" # If you initialize a variable with an empty container or "None" From 836de1be62fe878039318bd1baab9cf4d8c643d8 Mon Sep 17 00:00:00 2001 From: GeoffreyOnRails Date: Tue, 14 Oct 2025 18:18:23 +0200 Subject: [PATCH 3/3] Update cheat_sheet_py3.rst --- docs/source/cheat_sheet_py3.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/cheat_sheet_py3.rst b/docs/source/cheat_sheet_py3.rst index 2355e4ba239f2..028a7f10b5f34 100644 --- a/docs/source/cheat_sheet_py3.rst +++ b/docs/source/cheat_sheet_py3.rst @@ -227,7 +227,7 @@ When you're puzzled or when things are complicated # To find out what type mypy infers for an expression anywhere in # your program, wrap it in reveal_type(). Mypy will print an error # message with the type; remove it again before running the code, or - # import reveal_type from typing_extensions or typing (on Python 3.11 and newer) + # import reveal_type from typing_extensions or typing (on Python 3.11 and newer). reveal_type(1) # Revealed type is "builtins.int" # If you initialize a variable with an empty container or "None"