From a1b071f1c059cd00df601c7c51d70485345747b4 Mon Sep 17 00:00:00 2001 From: John Kershaw Date: Fri, 15 May 2026 22:38:14 +0100 Subject: [PATCH] Use type hint Move type info from variable name to type hint. --- .../putting_type_information_in_a_variable_name.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/readability/putting_type_information_in_a_variable_name.rst b/src/readability/putting_type_information_in_a_variable_name.rst index e2cafa2..ddd25d3 100644 --- a/src/readability/putting_type_information_in_a_variable_name.rst +++ b/src/readability/putting_type_information_in_a_variable_name.rst @@ -19,14 +19,14 @@ The code below demonstrates the dangers of variables whose names include type no Best practice ------------- -Remove type notation +Use type hint .................... Although the modifed code below does not fix the underlying problem of attempting to divide a number by a string, the code is generally less misleading, because there is no misleading description in the variable name ``n`` that ``n`` is a number. .. code:: python - n = "Hello, World!" + n: str = "Hello, World!" # still a problem, but less misleading now 4 / n