Author: Manuel Jacob
Branch: remove-list-smm-2
Changeset: r64186:01cb1c6441ed
Date: 2013-05-15 17:01 +0200
http://bitbucket.org/pypy/pypy/changeset/01cb1c6441ed/

Log:    Remove list.__iter__/__contains__ multi-methods.

diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -342,6 +342,17 @@
         result = self.length()
         return wrapint(space, result)
 
+    def descr_iter(self, space):
+        from pypy.objspace.std import iterobject
+        return iterobject.W_FastListIterObject(self)
+
+    def descr_contains(self, space, w_obj):
+        try:
+            self.find(w_obj)
+            return space.w_True
+        except ValueError:
+            return space.w_False
+
     def descr_getitem(self, space, w_index):
         if isinstance(w_index, W_SliceObject):
             # XXX consider to extend rlist's functionality?
@@ -1460,17 +1471,6 @@
 init_signature = Signature(['sequence'], None, None)
 init_defaults = [None]
 
-def contains__List_ANY(space, w_list, w_obj):
-    try:
-        w_list.find(w_obj)
-        return space.w_True
-    except ValueError:
-        return space.w_False
-
-def iter__List(space, w_list):
-    from pypy.objspace.std import iterobject
-    return iterobject.W_FastListIterObject(w_list)
-
 def add__List_List(space, w_list1, w_list2):
     w_clone = w_list1.clone()
     w_clone.extend(w_list2)
@@ -1689,6 +1689,8 @@
     __hash__ = None,
 
     __len__ = interp2app(W_ListObject.descr_len),
+    __iter__ = interp2app(W_ListObject.descr_iter),
+    __contains__ = interp2app(W_ListObject.descr_contains),
 
     __getitem__ = interp2app(W_ListObject.descr_getitem),
     __getslice__ = interp2app(W_ListObject.descr_getslice),
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to