Closed
python/peps
#3457Closed
Copy link
Description
The PEP-695 implementation added a new attribute __type_params__
to functions. I made this field read-only, but I realized there is a use case for writing to it: functools.wraps
, when wrapping a generic function, should add the .__type_params__
to the wrapper. Making it writable is also more consistent with other fields on functions, as even the __name__
of functions is writable.
The PEP also adds a __type_params__
attribute to classes and type aliases. For classes it's already writable (it's just stored in the type's __dict__
). For type aliases it's readonly, but as I don't see a use case for mutating a type alias's __type_params__
, I'd like to keep it that way.
Linked PRs
Metadata
Metadata
Assignees
Labels
only security fixesonly security fixesA feature request or enhancementA feature request or enhancement