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/2006-March/062108.html below:

[Python-Dev] collections.idset and collections.iddict?

[Python-Dev] collections.idset and collections.iddict? [Python-Dev] collections.idset and collections.iddict?Raymond Hettinger python at rcn.com
Tue Mar 7 01:08:02 CET 2006
[Neil Schemenauer]
>I occasionally need dictionaries or sets that use object identity
> rather than __hash__ to store items.  Would it be appropriate to add
> these to the collections module?

Why not decorate the objects with a class adding a method:
   def __hash__(self):
       return id(self)

That would seem to be more Pythonic than creating custom variants of other 
containers.


Raymond 
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