Author Prometheus3375
Recipients Prometheus3375
Date 2021-07-21.21:20:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1626902408.34.0.16297036439.issue44703@roundup.psfhosted.org>
In-reply-to
Content
from copy import copy, deepcopy
t = 1, 2
t1 = t, 3
t2 = t1, 4
t3 = t2, 5
assert copy(t3) is t3
assert deepcopy(t3) is t3

s = frozenset({1, 2})
assert s.copy() is s  # method .copy() always returns self, what its purpose?
assert copy(s) is s
assert deepcopy(s) is s  # raises AssertionError


Even a deepcopy of a tuple with many nested tuples is the the tuple itself, while a deepcopy of a frozenset which by definition cannot contain mutable objects is a new frozenset.
I think it is an error. A new frozenset is created because deepcopy() fallbacks to pickling.
History
Date User Action Args
2021-07-21 21:20:08Prometheus3375setrecipients: + Prometheus3375
2021-07-21 21:20:08Prometheus3375setmessageid: <1626902408.34.0.16297036439.issue44703@roundup.psfhosted.org>
2021-07-21 21:20:08Prometheus3375linkissue44703 messages
2021-07-21 21:20:08Prometheus3375create