A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-June/025063.html below:

[Python-Dev] d.get_key(key) -> key?

[Python-Dev] d.get_key(key) -> key? [Python-Dev] d.get_key(key) -> key?Martin v. Loewis martin@v.loewis.de
06 Jun 2002 08:44:30 +0200
"Daniel 'eikeon' Krech" <eikeon@eikeon.com> writes:

> Sorry, seems to me like it was on topic for python-dev seeing as
> python dictionaries do not currently have the functionality I
> desire. 

It sure is possible. You have been essentially asking the question
"How do I get the canonical member of an equivalence class in Python",
for which the canonical answer is "you intern the one member of each
equivalence class". As Barry Scott explains, this is best done with an
interning dictionary.

You are also asking "how do I efficiently implement sets in
Python". This is almost a FAQ, the answer is "if the elements are
hashable, use a dictionary".

Regards,
Martin




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