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

Mergetyping.Union andtypes.UnionType #105499

Closed
Assignees
JelleZijlstra
Labels
@JelleZijlstra

Description

@JelleZijlstra

Currently, unions created throughtyping.Union[A, B] and through thePEP-604 syntaxA | B are at runtime instances of completely different types, and they differ in exactly what elements they accept. This is confusing and makes it harder for users to detect unions at runtime.

I propose to proceed in two steps:

  1. Maketyping.Union an alias fortypes.UnionType and make it sotypes.UnionType[A, B] works, accepting the same typesUnion accepts now.
  2. Loosen the rules for what the| operator accepts to accept more types that are commonly used in unions.

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