This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, ncoghlan, pitrou, rhettinger
Date 2009-11-05.19:50:52
SpamBayes Score 4.829386e-09
Marked as misclassified No
Message-id <d38f5330911051150x33bfb17brdce660102182991c@mail.gmail.com>
In-reply-to <1257448562.56.0.696280957518.issue7224@psf.upfronthosting.co.za>
Content
On Thu, Nov 5, 2009 at 2:16 PM, Raymond Hettinger
<report@bugs.python.org> wrote:
>
> Raymond Hettinger <rhettinger@users.sourceforge.net> added the comment:
>
> The basic problem here is that the "one obvious way" to some people
> (including me and Martin v. Löwis) is to use a dictionary.  Further,
> there is the problem of conflating types in a user's mind -- right now,
> dictionaries are all about looking up and returning values, while sets
> are not.

One feature that is missing from both dict approach and get_equivalent
recipe is the ability to do interning of new values with a single
lookup.  Note that even at the C level one has to first try to
retrieve the key from the dictionary and then if that fails, do an
insert which repeats the same lookup.  Even dict.setdefault which is
designed to remove the double lookup while eliminates it when key is
present, still does the second lookup when the key is missing.
History
Date User Action Args
2009-11-05 19:50:54belopolskysetrecipients: + belopolsky, rhettinger, ncoghlan, pitrou
2009-11-05 19:50:52belopolskylinkissue7224 messages
2009-11-05 19:50:52belopolskycreate