[pypy-svn] r37710 - pypy/dist/pypy/objspace/std

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Feb 1 10:37:19 CET 2007


Author: cfbolz
Date: Thu Feb  1 10:37:16 2007
New Revision: 37710

Modified:
   pypy/dist/pypy/objspace/std/listobject.py
Log:
yet another small cleanup: use RPython's list.reverse


Modified: pypy/dist/pypy/objspace/std/listobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/listobject.py	(original)
+++ pypy/dist/pypy/objspace/std/listobject.py	Thu Feb  1 10:37:16 2007
@@ -442,15 +442,6 @@
 # Reverse a slice of a list in place, from lo up to (exclusive) hi.
 # (used in sort)
 
-def _reverse_slice(lis, lo, hi):
-    hi -= 1
-    while lo < hi:
-        t = lis[lo]
-        lis[lo] = lis[hi]
-        lis[hi] = t
-        lo += 1
-        hi -= 1
-
 class KeyContainer(baseobjspace.W_Root):
     def __init__(self, w_key, w_item):
         self.w_key = w_key
@@ -530,14 +521,14 @@
         # Reverse sort stability achieved by initially reversing the list,
         # applying a stable forward sort, then reversing the final result.
         if has_reverse:
-            _reverse_slice(sorter.list, 0, sorter.listlength)
+            sorter.list.reverse()
 
         # perform the sort
         sorter.sort()
 
         # reverse again
         if has_reverse:
-            _reverse_slice(sorter.list, 0, sorter.listlength)
+            sorter.list.reverse()
 
     finally:
         # unwrap each item if needed



More information about the Pypy-commit mailing list