Skip to content

docs: clarify Any assignment behavior - #22534

Open
pei711 wants to merge 1 commit into
python:masterfrom
pei711:codex/issue-22518-clarify-any-assignment
Open

pei711 wants to merge 1 commit into
python:masterfrom
pei711:codex/issue-22518-clarify-any-assignment

Conversation

@pei711

@pei711 pei711 commented Nov 22, 2026

Copy link
Copy Markdown

The dynamic typing guide says that assigning an Any value leaves an inferred variable statically typed. In practice, later expressions are treated as Any, while subsequent assignments are still checked against the original inferred type.

Update the example and explain this distinction so the documented behavior matches mypy.

Verification: confirmed the issue's minimal reproduction; the full Sphinx HTML build passed with external inventories disabled because inventory downloads stalled in this environment.

Fixes #22518

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.

mypy seems to forget inferred type after asigning an Any typed variable

1 participant