From 34a5b068dcdfc2a44fa2850e035e1b974cefecfe Mon Sep 17 00:00:00 2001 From: Joosboy <219508079+Joosboy@users.noreply.github.com> Date: Sun, 19 Jul 2026 14:01:43 +0530 Subject: [PATCH] Docs: clarify strict_optional description and link to more details (#21658) --- docs/source/command_line.rst | 3 ++- docs/source/config_file.rst | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index b8e4c7c187ba4..775dd22eaa49e 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -466,7 +466,8 @@ The following flags adjust how mypy handles values of type ``None``. .. warning:: ``--no-strict-optional`` is evil. Avoid using it and definitely do - not use it without understanding what it does. + not use it without understanding what it does. See + :ref:`no-strict-optional` for more details. .. _configuring-warnings: diff --git a/docs/source/config_file.rst b/docs/source/config_file.rst index d5431b1476aa0..bc8bc81f6387b 100644 --- a/docs/source/config_file.rst +++ b/docs/source/config_file.rst @@ -618,15 +618,16 @@ section of the command line docs. :type: boolean :default: True - Effectively disables checking of optional + If set to ``False``, effectively disables checking of optional types and ``None`` values. With this option, mypy doesn't generally check the use of ``None`` values -- it is treated as compatible with every type. .. warning:: - ``strict_optional = false`` is evil. Avoid using it and definitely do - not use it without understanding what it does. + ``strict_optional = False`` is evil. Avoid using it and definitely do + not use it without understanding what it does. See + :ref:`no-strict-optional` for more details. Configuring warnings