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

Examples shouldn't usetyping_extensions imports for stabletyping features #1986

Open
Labels
@smheidrich

Description

@smheidrich

Description

There are a few code examples in the docs which import things fromtyping_extensions that are by now available in Python'styping standard library module:

List

from typing_extensionsimport Never

from typing_extensionsimport ParamSpec

... and 4 more occurrences inreference/generics.rst.

from typing_extensionsimport Protocol

... and 4 more occurrences inreference/protocols.rst.

from typing_extensionsimport assert_type

It probably makes sense to usetyping imports for all of these instead, possibly with thetyping_extensions alternative mentioned.

How to fix?

What is the policy for these? Should they just be replaced with baretyping imports or something more like

fromtypingimportProtocol# or from typing_extensions for Python < 3.8

?
I haven't seen the latter in any of the other imports, which just import fromtyping without comment (EDIT: at least not in the code itself, but usually it is mentioned as an alternative for older versions somewhere around the code), but who knows...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp