[pypy-svn] r77765 - pypy/branch/fast-forward/lib_pypy

afa at codespeak.net afa at codespeak.net
Sun Oct 10 20:23:58 CEST 2010


Author: afa
Date: Sun Oct 10 20:23:56 2010
New Revision: 77765

Modified:
   pypy/branch/fast-forward/lib_pypy/_collections.py
Log:
Avoid quadratic behavior in deque.count().
Thanks Trundle!


Modified: pypy/branch/fast-forward/lib_pypy/_collections.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/_collections.py	(original)
+++ pypy/branch/fast-forward/lib_pypy/_collections.py	Sun Oct 10 20:23:56 2010
@@ -127,8 +127,8 @@
 
     def count(self, value):
         c = 0
-        for i in range(len(self)):
-            if self[i] == value:
+        for item in self:
+            if item == value:
                 c += 1
         return c
 



More information about the Pypy-commit mailing list