-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Subclass of dict doesn't inherit special signature #1010
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
Comments
Yeah, that was one of the limitations of my quick fix to the |
If we want to fix this in a non-hacky way we could potentially augment
|
I'm not sure that doesn't qualify as "hacky"... But it does seem reasonable given the absolute meaninglessness of the return type of It would require a PEP 484 change since the PEP currently explicitly says that I think there's another form that you'll need:
Interestingly, for |
I'm not a fan of this approach, especially if we'd also support the
Another way to implement would be to provide a special syntax for just this construct. A function decorator would work, though it would still be ugly. However, this is a rare issue so it might be acceptable. Perhaps something like this (the name is not the greatest):
|
Made obsolete by python/mypy#1010
Consider:
Python accepts this, but mypy complains:
But
dict(a=1, b=2)
works.The text was updated successfully, but these errors were encountered: