driscoll at cs.wisc.edu
Thu Feb 9 06:33:23 CET 2012
On 13:59, Nathan Rice wrote:
>> Turn the question around: why should there be?
>> Python is intentionally parsimonious in adding builtins.
> For the same reason there are frozensets?
> I put dicts in sets all the time. I just tuple the items, but that
> means you have to re-dict it on the way out to do anything useful with
> it. I am too lazy to write a frozendict or import one, but I would
> use it if it was a builtin.
I've wanted to do that as well.
My current use case is I want to have a dict as an attribute of another
object, and I want to use that object as a key in a dictionary. That
means that the outer object has to be immutable (an obnoxious enough
task on its own, BTW) and that either the dict itself has to be excluded
from computing the hash or the dict also has to be immutable.
Also, it's not like it has to be a builtin, per se. I know how to spell
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 552 bytes
Desc: OpenPGP digital signature
More information about the Python-list