[pypy-commit] pypy default: move a loop outside
fijal
noreply at buildbot.pypy.org
Tue Mar 27 00:34:42 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
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:
More information about the pypy-commit
mailing list