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.

classification
Title: copy - Allow dict.copy(deep=True) alongside copy.deepcopy() for easier usage and zen
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: TheCatster, iritkatriel, steven.daprano
Priority: normal Keywords:

Created on 2020-12-02 20:57 by TheCatster, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg382338 - (view) Author: Daniel Rose (TheCatster) Date: 2020-12-02 20:57
It would be convenient and cleaner/more in line with the Python zen to allow `.copy()` to allow a `deep=True` argument, to use `.deepcopy()` in a simpler way. This is easier to read, and brings some more usefulness to `.copy()`. `.deepcopy()` would be kept for backwards compatibility.
msg382339 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2020-12-02 21:04
This would be a classic example of the "Flag argument" anti-pattern:

https://www.martinfowler.com/bliki/FlagArgument.html
msg382345 - (view) Author: Daniel Rose (TheCatster) Date: 2020-12-02 21:43
My apologies. I worded that wrong, I meant adding `deep=True` to `dict.copy()`. Otherwise, you're absolutely right.
msg382347 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-12-02 21:59
Deprecating an API is a big project. To justify the time people would have to put into this, it needs to have significant benefits. I don't see them and the OP didn't explain what they are. 

Suggestions like this should ideally be brought up for discussion on the python-ideas mailing list before submitted here.
History
Date User Action Args
2022-04-11 14:59:38adminsetgithub: 86712
2020-12-02 21:59:45iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg382347

resolution: rejected
stage: resolved
2020-12-02 21:43:10TheCatstersetmessages: + msg382345
2020-12-02 21:42:27TheCatstersettitle: copy - Allow .copy(deep=True) alongside .deepcopy() for easier usage and zen -> copy - Allow dict.copy(deep=True) alongside copy.deepcopy() for easier usage and zen
2020-12-02 21:04:10steven.dapranosetnosy: + steven.daprano
messages: + msg382339
2020-12-02 20:57:34TheCatstercreate