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

TypedDict syntax variant with keyword arguments #2492

Closed
JukkaL opened this issue Nov 24, 2016 · 6 comments
Closed

TypedDict syntax variant with keyword arguments #2492

JukkaL opened this issue Nov 24, 2016 · 6 comments

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Nov 24, 2016

Support defining typed dicts like this:

Point = TypedDict('Point', x=int, y=int)
@davidfstr
Copy link
Contributor

FYI: I've started work on this.

@davidfstr
Copy link
Contributor

FYI: I've started work on this.

Needless to say life has gotten busy on my end and I'm not expecting to resume work on this task in a reasonable timeframe.

I do have a partial patch that I started several months ago, but it may not be so useful since it is based on a very old version of the tree.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jun 15, 2017

It's less clear if this is a good idea now that we also have the convenient class-based syntax, and we are going to use a keyword argument to specify that a typed dict may have missing items (see discussion at #2632).

@ilevkivskyi
Copy link
Member

Some people might prefer the functional form. Both forms have their pluses and minuses, see the recent discussion in python/typing#427 and subsequent idea #3520

@gvanrossum What do you think?

@gvanrossum
Copy link
Member

The functional form works in all Python versions.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jan 28, 2020

This doesn't seem feasible now that we have the total=<bool> keyword argument to TypedDict. Also, TypedDict is officially supported in Python and we want to avoid mypy-specific extensions.

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