Skip to content

Support declaring TypedDict type with class-based syntax (for Python 3.6+) #2740

Closed

Description

@davidfstr
  • Support basic declaration:
class Point2D(TypedDict):
    x: int
    y: int
  • Support class-based inheritance as syntactic sugar for copying fields
class Point3D(Point2D):
    z: int

There is already support for the above syntaxes at runtime but the typechecker doesn't reconcognize it yet.

Activity

  1. ilevkivskyi commented on Jan 23, 2017

    @ilevkivskyi
    Member

    @davidfstr I wanted to work on this soon. Do you prefer to do it yourself?

  2. davidfstr commented on Jan 25, 2017

    @davidfstr
    ContributorAuthor

    @ilevkivskyi Go for it. Help is definitely welcome, as my coding time outside work is highly constrained.

    In case it's of interest the next item I'm working on is #2492 and #2739 (together).

  3. ilevkivskyi commented on Feb 5, 2017

    @ilevkivskyi
    Member

    @davidfstr Here is the PR #2808 I promised.

  4. jonmcoe commented on Sep 7, 2018

    @jonmcoe

    is it possible to inherit in python2?

    I see error: TypedDict class syntax is only supported in Python 3.6 when trying to inherit in the class fashion above. wondering if there is another approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions