Skip to content

Fix inconsistent strict_optional documentation#21661

Open
BHUVANSH855 wants to merge 1 commit into
python:masterfrom
BHUVANSH855:fix-21658-strict-optional-docs
Open

Fix inconsistent strict_optional documentation#21661
BHUVANSH855 wants to merge 1 commit into
python:masterfrom
BHUVANSH855:fix-21658-strict-optional-docs

Conversation

@BHUVANSH855

Copy link
Copy Markdown

Summary

Fix the inconsistent description of strict_optional in the documentation.

Changes

  • Clarify that strict_optional = true enables checking of optional types and None values.
  • Explain that strict_optional = false disables that checking.
  • Add links from the strict_optional and --no-strict-optional warnings to the "Optional types and the None type" documentation for additional context.

Fixes #21658

@A5rocks A5rocks left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but this docs change is kind of nonsensical.

Comment thread docs/source/command_line.rst Outdated
Comment thread docs/source/config_file.rst Outdated
Comment thread docs/source/config_file.rst Outdated
@BHUVANSH855 BHUVANSH855 force-pushed the fix-21658-strict-optional-docs branch from 4e830ea to fbf67f7 Compare July 1, 2026 03:43
@BHUVANSH855 BHUVANSH855 requested a review from A5rocks July 1, 2026 03:43

@A5rocks A5rocks left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. @95-martin-orion what do you think?

@95-martin-orion

Copy link
Copy Markdown

Add links from the strict_optional and --no-strict-optional warnings to the "Optional types and the None type" documentation for additional context.

I don't see where these links were added, but otherwise this fixes the issue I was seeing. Thanks!

@A5rocks

A5rocks commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

I asked them to remove the links since it didn't seem to add anything, since the sections are already describing strict-optional.

@95-martin-orion

Copy link
Copy Markdown

Fair enough. My concern (which does not need to block this PR) was that the note "--no-strict-optional is evil" provides very little information on why it is considered evil. This is fine for preventing people from using it in the first place, but not terribly helpful for users working in a codebase which already uses it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent description of strict_optional

3 participants