Author: Brian Kearns <[email protected]>
Branch:
Changeset: r61027:868fc49b4595
Date: 2013-02-10 02:19 -0500
http://bitbucket.org/pypy/pypy/changeset/868fc49b4595/
Log: port a couple deque.rotate optimizations to the interp module
diff --git a/pypy/module/_collections/interp_deque.py
b/pypy/module/_collections/interp_deque.py
--- a/pypy/module/_collections/interp_deque.py
+++ b/pypy/module/_collections/interp_deque.py
@@ -287,9 +287,9 @@
def rotate(self, n=1):
"Rotate the deque n steps to the right (default n=1). If n is
negative, rotates left."
len = self.len
- if len == 0:
+ if len <= 1:
return
- halflen = (len+1) >> 1
+ halflen = len >> 1
if n > halflen or n < -halflen:
n %= len
if n > halflen:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit