[pypy-svn] r15900 - pypy/dist/pypy/lib/test2

arigo at codespeak.net arigo at codespeak.net
Wed Aug 10 11:05:02 CEST 2005


Author: arigo
Date: Wed Aug 10 11:05:00 2005
New Revision: 15900

Modified:
   pypy/dist/pypy/lib/test2/test_deque_extra.py
Log:
The reimplementation of reversed() is now in the py lib, which has names in
'py.builtin.*' precisely for this kind of compatibility.

Don't forget to 'svn up' at the level of the 'dist' directory to get the
updated py lib.


Modified: pypy/dist/pypy/lib/test2/test_deque_extra.py
==============================================================================
--- pypy/dist/pypy/lib/test2/test_deque_extra.py	(original)
+++ pypy/dist/pypy/lib/test2/test_deque_extra.py	Wed Aug 10 11:05:00 2005
@@ -1,20 +1,10 @@
 # Deque Tests
 
 # for passing the test on top of 2.3
-try:
-    reversed
-except NameError:
-    def reversed(seq): # fall-back
-        if hasattr(seq, '__reversed__'):
-            return seq.__reversed__()
-        def gen():
-            i = len(seq)-1
-            while i >= 0:
-                yield seq[i]
-                i -= 1
-        return gen()
-    import  pypy.lib.collections
-    pypy.lib.collections.reversed = reversed
+from py.builtin import reversed
+import pypy.lib.collections
+pypy.lib.collections.reversed = reversed
+
 
 n = 10
 class Test_deque:



More information about the Pypy-commit mailing list