This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Make dict views copyable
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.6
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, rhettinger, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016-06-07 16:27 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
dict_views_copy.patch serhiy.storchaka, 2016-06-07 16:27 review
Messages (5)
msg267701 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-07 16:27
Proposed patch adds support of dict views in the copy module.

Since dict views are immutable, copy.copy() just returns the same object.

copy.deepcopy() returns a frozenset for the dict_keys object, a tuple for the dict_values object, and a dict_items object for the dict_items object. Only needed data is copied (keys for dict_keys, values for dict_values).
msg267703 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016-06-07 16:39
I'm still not clear about the use case -- have you heard from people who had to work around the current situation?  Use of the copy module is often a code smell in my experience, so I don't want to encourage it.
msg267713 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-07 18:24
I didn't encounter this.
msg267717 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-06-07 18:35
I think we should stop adding features like this without actual user requests and real use cases to show necessity and to inform the design.
msg267756 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-06-08 00:11
See also:
Date User Action Args
2022-04-11 14:58:32adminsetgithub: 71439
2016-06-26 21:41:58serhiy.storchakasetstatus: open -> closed
resolution: rejected
stage: patch review -> resolved
2016-06-08 00:11:26rhettingersetmessages: + msg267756
2016-06-07 18:35:30rhettingersetmessages: + msg267717
2016-06-07 18:24:14serhiy.storchakasetmessages: + msg267713
2016-06-07 16:39:56gvanrossumsetmessages: + msg267703
2016-06-07 16:27:29serhiy.storchakacreate