Skip to content

docs: rename "value restriction" to "value-constrained type variable"#21112

Merged
hauntsaninja merged 1 commit intopython:masterfrom
nuglifeleoji:docs/rename-value-restriction-to-constrained
Mar 31, 2026
Merged

docs: rename "value restriction" to "value-constrained type variable"#21112
hauntsaninja merged 1 commit intopython:masterfrom
nuglifeleoji:docs/rename-value-restriction-to-constrained

Conversation

@nuglifeleoji
Copy link
Copy Markdown
Contributor

Closes #17828.

The docs used "value restriction" to describe type variables like T: (str, bytes), but the runtime attribute is TypeVar.__constraints__. This PR updates the terminology across the affected doc pages to use "value-constrained type variable" consistently, matching the runtime naming and the term discussed in #17828.

Changes:

  • generics.rst: rename section title, update prose, add new anchor value-constrained-type-variables (old anchor type-variable-value-restriction kept for backward compat)
  • more_types.rst: update cross-reference text
  • command_line.rst: update cross-reference text

Made with Cursor

Align documentation terminology with the runtime attribute name
(`TypeVar.__constraints__`). The section now uses "value-constrained
type variable" consistently, and the old anchor
`type-variable-value-restriction` is kept alongside the new one
`value-constrained-type-variables` to avoid breaking external links.

Closes python#17828

Made-with: Cursor
@hauntsaninja hauntsaninja merged commit a25c331 into python:master Mar 31, 2026
2 checks passed
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.

Replace uses of type variable "value restriction" with "constraints"

2 participants