Author: Maciej Fijalkowski <[email protected]>
Branch: 
Changeset: r54011:efe9b0fe618a
Date: 2012-03-27 00:34 +0200
http://bitbucket.org/pypy/pypy/changeset/efe9b0fe618a/

Log:    move a loop outside

diff --git a/pypy/objspace/std/bytearrayobject.py 
b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -114,9 +114,12 @@
     if step == 1 and 0 <= start <= stop:
         newdata = data[start:stop]
     else:
-        newdata = [data[start + i*step] for i in range(slicelength)]
+        newdata = _getitem_slice_multistep(data, start, step, slicelength)
     return W_BytearrayObject(newdata)
 
+def _getitem_slice_multistep(data, start, step, slicelength):
+    return [data[start + i*step] for i in range(slicelength)]
+
 def contains__Bytearray_Int(space, w_bytearray, w_char):
     char = space.int_w(w_char)
     if not 0 <= char < 256:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to