Skip to content

OrderedDict.copy() returns an OrderedDict #1642

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

Closed
gvanrossum opened this issue Oct 2, 2017 · 2 comments · Fixed by #1656
Closed

OrderedDict.copy() returns an OrderedDict #1642

gvanrossum opened this issue Oct 2, 2017 · 2 comments · Fixed by #1656

Comments

@gvanrossum
Copy link
Member

We should add this to the stub for OrderedDict. (Both Python 2 and 3.)

Note that we can't fix this by using a self-type for dict.copy() because in general if you subclass dict and don't override copy(), your copy() method will return just a dict. But OrderedDict.copy() overrides this behavior and the typeshed stub should say so.

@elazarg
Copy link
Contributor

elazarg commented Oct 19, 2017

I don't think this is closed yet. #1656 didn't fix this, since the added __copy__ method is related to the copy() protocol, not to the interface of OrderedDict. The right fix is to add a copy method (perhaps in addition to __copy__).

@JelleZijlstra JelleZijlstra reopened this Oct 19, 2017
ilevkivskyi pushed a commit that referenced this issue Feb 9, 2018
Solves issue #1642. A previous attempt at this, #1656,
added __copy__ but omitted copy, and it did not properly use self-type.
@ilevkivskyi
Copy link
Member

Fixed by #1856

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 a pull request may close this issue.

4 participants