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/2010-May/100107.html below:

Possible patch for functools partial...)

[Python-Dev] frozendict (was: Possible patch for functools partial...) [Python-Dev] frozendict (was: Possible patch for functools partial...)Yaniv Aknin yaniv at aknin.name
Sun May 16 03:55:14 CEST 2010
>
> > So I'm thinking either we make an
> > immutable/hashable dict while we're at it, or store the keyword
> > arguments as a tuple (which guarantees immutability), and only
> > convert them back to a dict when you want to call the partial object
> > (simpler, slower).
>
> I'd support an immutable dict. [...]


I've set out to implement a frozendict (like frozenset) for use to store
functools.keywords' attribute, and quickly realized I didn't think of an
obvious flaw in that idea. A frozenset will only accept hashable members,
but a frozendict can't afford this luxury for its values.

I'm not sure how should I go about handling that, if at all. Should I
implement a frozendict which will remain unhashable but support equality
testing like a regular dict? A frozendict that is only hashable if all its
values are hashable, like a tuple? Is the whole notion of a frozendict
worthy, given this limitation?

I'd be happy to hear python-dev's guidance on this.

Cheers,
 - Yaniv
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100516/c8fd32eb/attachment.html>
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