On Fri, 08 Oct 2010 00:23:30 +0000, kj wrote:

> In <87hbgxlk67....@gmail.com> Arnaud Delobelle <arno...@gmail.com>
> writes:
> 
>>A simple fix is to use hash(frozenset(self.items())) instead.
> 
> Thanks for pointing out the hash bug.  It was an oversight: I meant to
> write
> 
>     def __hash__(self):
>         return hash(sorted(tuple(self.items())))
> 
> I imagine that frozenset is better than sorted(tuple(...)) here, but
> it's not obvious to me why.


Because it's always better to use a well-written, fast, efficient, 
correct, well-tested wheel than to invent your own slow, incorrect 
wheel :)



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to