Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

function.__type_params__ and type.__type_params__ should be writable #104600

Closed
python/peps
#3457
Assignees
JelleZijlstra
Labels
@JelleZijlstra

Description

@JelleZijlstra

ThePEP-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

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp