Skip to content

Add documentation for subclass attribute type narrowing#20972

Closed
dhanusharer wants to merge 1 commit intopython:masterfrom
dhanusharer:docs-subclass-attribute-narrowing
Closed

Add documentation for subclass attribute type narrowing#20972
dhanusharer wants to merge 1 commit intopython:masterfrom
dhanusharer:docs-subclass-attribute-narrowing

Conversation

@dhanusharer
Copy link

Adds documentation explaining how mypy may infer more specific
types for subclass attributes when a subclass assigns a value
to a class attribute defined in a base class.

Includes an example demonstrating how attribute types can be
narrowed based on assignment.

Fixes #14760

@hauntsaninja
Copy link
Collaborator

There isn't a common issue here

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.

Subclass attribute type narrowing on assignment

2 participants