(original) (raw)
> So I'm thinking either we make anI'd support an immutable dict. \[...\]
> 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'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