Am 07.10.2010 22:02, schrieb Chris Rebert:
> On Thu, Oct 7, 2010 at 12:13 PM, kj <[email protected]> wrote:
> <snip>
>> It would facilitate the implementation of t() to have a simple test
>> for mutability. Is there one?
>
> Non-default hashability is an approximate heuristic:
Except that every user defined class is hashable and mutable by default ;)
>>> class Example(object):
... pass
...
>>> example = Example()
>>> hash(example)
139810551284624
>>> example.__dict__
{}
>>> example.egg = "spam"
>>> example.__dict__
{'egg': 'spam'}
--
http://mail.python.org/mailman/listinfo/python-list