-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionenhancement requestNew feature or requestNew feature or requestspec compliance
Description
The typing spec indicates that if an instance variable within a generic class is generic, an attempt to access it through the class object should generate an error because the type is erased at runtime for the class.
from typing import Generic, TypeVar
T = TypeVar("T")
class Node(Generic[T]):
label: T
def __init__(self, label: T | None = None) -> None:
...
Node[int].label = 1 # Should be type error
Node[int].label # Should be type error
Node.label # Should be type errorReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionenhancement requestNew feature or requestNew feature or requestspec compliance