Skip to content

Prototype support for typed **kwargs #3002

Closed

Description

Many people have requested support for a way to type **kwargs with a TypedDict. There have been proposals to support this using the Unpack type introduced in the recently-accepted PEP 646.

It would be good to prototype this to uncover any potential issues.

  • How to handle required fields that are not supplied by the caller?
  • How to handle function assignment when the source type contains one of these unpacked TypedDicts?
  • Is it necessary/desirable to support unions of TypedDicts? This adds significant complexity.
  • Should it support * unpack operator introduced in PEP 646?
  • How to handle references to kwargs within the function implementation? Is it the same as any other TypedDict reference?
  • How do we deal with the case where a keyword parameter has a name that overlaps with an entry in the TypedDict?
  • Should it be an error if an unpacked mapping (with unknown keys) is passed to the function?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions