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

mwh at codespeak.net mwh at codespeak.net
Thu Jun 23 13:34:01 CEST 2005


Author: mwh
Date: Thu Jun 23 13:34:00 2005
New Revision: 13698

Modified:
   pypy/dist/pypy/objspace/std/mro.py
Log:
avoid the use of index


Modified: pypy/dist/pypy/objspace/std/mro.py
==============================================================================
--- pypy/dist/pypy/objspace/std/mro.py	(original)
+++ pypy/dist/pypy/objspace/std/mro.py	Thu Jun 23 13:34:00 2005
@@ -37,7 +37,13 @@
         cycle.append(candidate)
         nextblockinglist = blockinglist(candidate, orderlists)
         candidate = nextblockinglist[0]
-    del cycle[:cycle.index(candidate)]
+    # avoid the only use of list.index in the PyPy code base:
+    i = 0
+    for c in cycle:
+        if c == candidate:
+            break
+        i += 1
+    del cycle[:i]
     cycle.append(candidate)
     cycle.reverse()
     names = [cls.__name__ for cls in cycle]



More information about the Pypy-commit mailing list