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/2012-February/117041.html below:

[Python-Dev] Add a frozendict builtin type

[Python-Dev] Add a frozendict builtin type [Python-Dev] Add a frozendict builtin typeMark Shannon mark at hotpy.org
Tue Feb 28 13:07:32 CET 2012
Antoine Pitrou wrote:
> On Tue, 28 Feb 2012 12:45:54 +0100
> Victor Stinner <victor.stinner at haypocalc.com> wrote:
>>> I think you need to elaborate on your use cases further, ...
>> A frozendict can be used as a member of a set or as a key in a dictionary.
>>
>> For example, frozendict is indirectly needed when you want to use an
>> object as a key of a dict, whereas one attribute of this object is a
>> dict.
> 
> It isn't. You just have to define __hash__ correctly.
> 
>> frozendict helps also in threading and multiprocessing.
> 
> How so?

Inter process/task communication requires copying. Inter/intra thread
communication uses reference semantics. To ensure these are the same,
the objects used in communication must be immutable.

Cheers,
Mark.
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