A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-November/040380.html below:

[Python-Dev] copy() and deepcopy()

[Python-Dev] copy() and deepcopy()Aahz aahz at pythoncraft.com
Sat Nov 22 09:21:19 EST 2003
On Sat, Nov 22, 2003, Raymond Hettinger wrote:
>
> The point of a deepcopy is to replace each sub-component (at every
> nesting level) that could possibly change.  Since sets can only contain
> hashable objects which in turn can only contain hashable objects, I
> surmise that a shallowcopy of a set would also suffice as its deepcopy.

Thing is, it *is* possible to have a mutable and hashable object.  The
hashable part needs to be immutable, but not the rest.  Consider dicts
in the generic sense: the key needs to be immutable, but the value need
not, and it certainly can be useful to combine key/value into a single
object.

Now, I'm still not sure that your analysis is wrong, but I wanted to be
very, very clear that hashability is not the same thing as immutability.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4