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/2009-October/093313.html below:

[Python-Dev] Retrieve an arbitrary element from a set without removing it

[Python-Dev] Retrieve an arbitrary element from a set without removing it [Python-Dev] Retrieve an arbitrary element from a set without removing it"Martin v. Löwis" martin at v.loewis.de
Sun Oct 25 19:43:52 CET 2009
> Given Alexander's premise, I agree with your response. But his premise
> is wrong. Python's current builtin set class maps abstract equivalence
> classes to representative members. And this *is* useful. Mapping
> arbitrary members of such classes to representative members, sometimes
> called 'canonical', is a standard problem/goal in math. String interning
> is an application of this idea.

Right. However, this is conceptually a function. In some cases (like
string interning), it is mutable (over time) and finite (at any point in
time). We already have a data type that can perfectly represent mutable
finite funcitons, namely dictionaries. And indeed, interning is
implemented by a dictionary.

What Alexander wants is that the set type also becomes useful for
storing canonical representations. I find that inappropriate, since
dicts already provide the one obvious way to do it.

Regards,
Martin
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