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

Add__class_getitem__ tologging.LoggerAdapter andlogging.StreamHandler #92128

Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-featureA feature request or enhancement
@AlexWaygood

Description

@AlexWaygood

Feature or enhancement

logging.LoggerAdapter andlogging.StreamHandler are generic in typeshed but cannot currently be parameterised at runtime. This has been reported several times to typeshed as being quite painful for end users, since these are both classes that users like to subclass:

If you're a user of type hints, subclassing a class that's generic in the stub but not at runtime usually means that you have to do something horrible withif TYPE_CHECKING (e.g. seepython/typeshed#5954 (comment)).

The stubs for these classes have been fairly stable in typeshed for a while; I think it's unlikely that we'll ever want to make them non-generic again over at typeshed. I therefore propose that__class_getitem__ be added to these two classes in 3.11, so that they can be parameterised at runtime.

Cc.@vsajip for thelogging module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp