Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support calling dict() with positional arguments and keyword arguments or **kwargs - #1391

Merged
gvanrossum merged 3 commits into
masterfrom
dict-signatures
Apr 18, 2016
Merged

Support calling dict() with positional arguments and keyword arguments or **kwargs#1391
gvanrossum merged 3 commits into
masterfrom
dict-signatures

Conversation

@JukkaL

@JukkaL JukkaL commented Apr 17, 2016

Copy link
Copy Markdown
Collaborator

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.

JukkaL added 3 commits April 17, 2016 12:56
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

JukkaL commented Apr 17, 2016

Copy link
Copy Markdown
Collaborator Author

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.

2 participants