Received: from localhost (HELO mail.python.org) (127.0.0.1)
by albatross.python.org with SMTP; 01 Jun 2010 10:01:09 +0200
X-Greylist: delayed 493 seconds by postgrey-1.31 at albatross;
Tue, 01 Jun 2010 10:01:09 CEST
Received: from smtp190.iad.emailsrvr.com (smtp190.iad.emailsrvr.com
[207.97.245.190])
(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mail.python.org (Postfix) with ESMTPS
for <python-ideas-+ZN9ApsXKcEdnm+***@public.gmane.org>; Tue, 1 Jun 2010 10:01:09 +0200 (CEST)
Received: from relay9.relay.iad.mlsrvr.com (localhost [127.0.0.1])
by relay9.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id 9A9201E510F;
Tue, 1 Jun 2010 03:52:51 -0400 (EDT)
Received: by relay9.relay.iad.mlsrvr.com (Authenticated sender:
jh-AT-improva.dk) with ESMTPSA id 0CC811E3067;
Tue, 1 Jun 2010 03:52:50 -0400 (EDT)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4
In-Reply-To: <A13D6A8C-C5EE-4AC7-A419-85CEC08F981A-***@public.gmane.org>
X-Enigmail-Version: 1.0.1
X-BeenThere: python-ideas-+ZN9ApsXKcEdnm+***@public.gmane.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Discussions of speculative Python language ideas
<python-ideas.python.org>
List-Unsubscribe: <http://mail.python.org/mailman/options/python-ideas>,
<mailto:python-ideas-request-+ZN9ApsXKcEdnm+***@public.gmane.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-ideas>
List-Post: <mailto:python-ideas-+ZN9ApsXKcEdnm+***@public.gmane.org>
List-Help: <mailto:python-ideas-request-+ZN9ApsXKcEdnm+***@public.gmane.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-ideas>,
<mailto:python-ideas-request-+ZN9ApsXKcEdnm+***@public.gmane.org?subject=subscribe>
Sender: python-ideas-bounces+gcpi-python-ideas=m.gmane.org-+ZN9ApsXKcEdnm+***@public.gmane.org
Errors-To: python-ideas-bounces+gcpi-python-ideas=m.gmane.org-+ZN9ApsXKcEdnm+***@public.gmane.org
Archived-At: <http://permalink.gmane.org/gmane.comp.python.ideas/7251>
Post by Raymond HettingerPost by Benjamin PetersonEssentially these are places where defined equality should not matter.
"should not matter" is the important part here. It might have been
clearer to say "should be ignored" instead. I think Raymond is
misunderstanding it.
Post by Raymond HettingerEssentially, these are cases where an identity dictionary isn't
necessary and would in-fact be worse performance-wise
in every implementation except for PyPy which can compile
the pure python code for indentity_dict.py.
It is necessary, because the objects involved might define their own
__hash__ and __cmp__/__eq__, and these should *not* be used.
Post by Raymond HettingerSorry, but I think this idea is a total waste. Perhaps post it as
a recipe, but it doesn't make sense to try to inject it into the
standard library.
I don't think it is a total waste, but I have seen two ideas in this
thread that I find more generally useful. One is
"collections.keyfuncdict", which could be trivially used as an
identitydict. The other is a WeakIdentityDict, which is a WeakKeyDict
that uses only the identity of the keys for hashing/equality. These two
are independent, one cannot be used to implement the other (unless
collections.keyfuncdict grows an option to not keep strong refs to the
keys, perhaps by providing the inverse keyfunc instead).
Anyway, +0.1 on identitydict and +1 on each of collection.keyfuncdict
and WeakIdentityDict.
- Jacob