[pypy-svn] pypy default: (alex, fijal) split unicode_join and str_join into non-looping and looping

fijal commits-noreply at bitbucket.org
Mon Mar 14 02:06:40 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r42586:5534161458d3
Date: 2011-03-13 21:06 -0400
http://bitbucket.org/pypy/pypy/changeset/5534161458d3/

Log:	(alex, fijal) split unicode_join and str_join into non-looping and
	looping part

diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -193,6 +193,9 @@
         if space.is_w(space.type(w_s), space.w_unicode):
             return w_s
 
+    return _unicode_join_many_items(space, w_self, list_w, size)
+
+def _unicode_join_many_items(space, w_self, list_w, size):
     self = w_self._value
     sb = UnicodeBuilder()
     for i in range(size):

diff --git a/pypy/objspace/std/stringobject.py b/pypy/objspace/std/stringobject.py
--- a/pypy/objspace/std/stringobject.py
+++ b/pypy/objspace/std/stringobject.py
@@ -338,6 +338,9 @@
             space.is_w(space.type(w_s), space.w_unicode)):
             return w_s
 
+    return _str_join_many_items(space, w_self, list_w, size)
+
+def _str_join_many_items(space, w_self, list_w, size):
     self = w_self._value
     reslen = len(self) * (size - 1)
     for i in range(size):


More information about the Pypy-commit mailing list