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

pmaupin at codespeak.net pmaupin at codespeak.net
Wed Dec 17 17:37:47 CET 2003


Author: pmaupin
Date: Wed Dec 17 17:37:46 2003
New Revision: 2457

Modified:
   pypy/trunk/src/pypy/objspace/std/listobject.py
Log:
Added delitem

Modified: pypy/trunk/src/pypy/objspace/std/listobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/listobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/listobject.py	Wed Dec 17 17:37:46 2003
@@ -168,6 +168,19 @@
 # upto here, lists are nearly identical to tuples, despite the
 # fact that we now support over-allocation!
 
+def delitem__List_Int(space, w_list, w_idx):
+    i = w_idx.intval
+    if i < 0:
+        i += w_list.ob_size
+    if i < 0 or i >= w_list.ob_size:
+        raise OperationError(space.w_IndexError,
+                             space.wrap("list deletion index out of range"))
+    _del_slice(w_list, i, i+1)
+    return space.w_None
+
+def delitem__List_Slice(space, w_list, w_slice):
+    return _setitem_slice_helper(space, w_list, w_slice, [], 0)
+
 def setitem__List_Int_ANY(space, w_list, w_index, w_any):
     items = w_list.ob_item
     idx = w_index.intval


More information about the Pypy-commit mailing list