[pypy-svn] rev 2649 - pypy/trunk/src/pypy/objspace/std

alex at codespeak.net alex at codespeak.net
Sat Dec 20 15:38:02 CET 2003


Author: alex
Date: Sat Dec 20 15:38:01 2003
New Revision: 2649

Modified:
   pypy/trunk/src/pypy/objspace/std/dictobject.py
Log:
simplified implementation by making has_key a synonym for __contains__


Modified: pypy/trunk/src/pypy/objspace/std/dictobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/dictobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/dictobject.py	Sat Dec 20 15:38:01 2003
@@ -136,6 +136,8 @@
             return space.w_True
     return space.w_False
 
+dict_has_key__Dict_ANY = contains__Dict_ANY
+
 def iter__Dict(space, w_dict):
     import iterobject
     w_keys = dict_keys__Dict(space, w_dict)
@@ -200,15 +202,6 @@
                            for w_key,cell in
                            w_self.non_empties()])
 
-def dict_has_key__Dict_ANY(space, w_self, w_lookup):
-    data = w_self.non_empties()
-    # XXX hashing? -- mwh
-    for w_key, cell in data:
-        if space.is_true(space.eq(w_lookup, w_key)):
-            return space.newbool(1)
-    else:
-        return space.newbool(0)
-
 def dict_clear__Dict(space, w_self):
     w_self.data = []
 


More information about the Pypy-commit mailing list