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 calling dict() with positional arguments and keyword arguments or **kwargs #1391

Merged
merged 3 commits into from Apr 18, 2016

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Apr 17, 2016

Also inherit special signature of dict. Some special cases (that are likely very rare) are not handled well. I'll create a separate issue for those. The implementation is a hack but it mostly does the right thing and is fairly simple, and a clean solution would be much more complicated (for example, a plugin system or constraint based type inference system for function signatures), so I think this is okay for now.

This is a stop-gap solution until we implement a general plugin
system for functions, or similar.

Fix #984. Also mostly fix #1010 (except for some special cases).
Still cases like this are broken:

class D(Dict[S, T], Generic[T, S]): ...

Also, we don't catch all invalid uses of keyword arguments
with dict subclasses.
@JukkaL
Copy link
Collaborator Author

JukkaL commented Apr 17, 2016

Previous commits (8787567 and 75d3dca) changed the stubs of dict to accept keyword arguments. This PR adds better type checking around it.

@gvanrossum gvanrossum merged commit 5d2dfce into master Apr 18, 2016
@gvanrossum gvanrossum deleted the dict-signatures branch April 20, 2016 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants