Author: Lukas Diekmann <[email protected]>
Branch: list-strategies
Changeset: r47458:6f8c358e4389
Date: 2011-03-09 14:12 +0100
http://bitbucket.org/pypy/pypy/changeset/6f8c358e4389/
Log: Refactored RangeListStrateg.pop()
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
@@ -357,16 +357,12 @@
#XXX merge these parts
l = self.cast_from_void_star(w_list.storage)
- if index == 0:
+ if index in [0, self.length(w_list)-1]:
r = self.getitem(w_list, index)
- new = self.cast_to_void_star((l[0]+l[1],l[1],l[2]-1))
- w_list.storage = new
- w_list.check_empty_strategy()
- return r
-
- if index == self.length(w_list)-1:
- r = self.getitem(w_list, index)
- new = self.cast_to_void_star((l[0],l[1],l[2]-1))
+ if index == 0:
+ new = self.cast_to_void_star((l[0]+l[1],l[1],l[2]-1))
+ else:
+ new = self.cast_to_void_star((l[0],l[1],l[2]-1))
w_list.storage = new
w_list.check_empty_strategy()
return r
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit