Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks
davidfstr opened this issue Jan 22, 2017 · 4 comments
Closed
2 tasks

Comments

@davidfstr
Copy link
Contributor

  • 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.

@ilevkivskyi
Copy link
Member

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

@davidfstr
Copy link
Contributor Author

davidfstr commented Jan 25, 2017

@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).

@ilevkivskyi
Copy link
Member

@davidfstr Here is the PR #2808 I promised.

@jonmcoe
Copy link

jonmcoe commented Sep 7, 2018

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
Projects
None yet
Development

No branches or pull requests

4 participants