Skip to content

Spec change: explicitly permit (statically known) conditional fields in TypedDict, NamedTuple, Enum, and dataclasses #58

Closed

Description

@carljm

Please consider the change to explicitly permit fields of TypedDict/NamedTuple/Enum/dataclasses to be conditional based on Python version and similar statically-known conditions.

Discuss thread, with agreement from everyone who commented: https://discuss.python.org/t/allowing-typeddict-items-to-be-defined-conditionally-via-statically-known-conditions/102973
Spec / conformance suite PR: python/typing#2263

  • Carl
  • Dave
  • Jelle
  • Jukka
  • Rebecca

Activity

  1. changed the title [-]Spec change: explicitly permit (statically known) conditional fields in TypedDict and NamedTuple[/-] [+]Spec change: explicitly permit (statically known) conditional fields in TypedDict, NamedTuple, Enum, and dataclasses[/+] on Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions