Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #11263 > unrolled thread

Re: String concatenation - which is the fastest way ?

Started byChris Angelico <rosuav@gmail.com>
First post2011-08-12 10:20 +0100
Last post2011-08-12 10:20 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: String concatenation - which is the fastest way ? Chris Angelico <rosuav@gmail.com> - 2011-08-12 10:20 +0100

#11263 — Re: String concatenation - which is the fastest way ?

FromChris Angelico <rosuav@gmail.com>
Date2011-08-12 10:20 +0100
SubjectRe: String concatenation - which is the fastest way ?
Message-ID<mailman.2212.1313140844.1164.python-list@python.org>
On Thu, Aug 11, 2011 at 3:39 PM,  <przemolicc@poczta.fm> wrote:
> On Thu, Aug 11, 2011 at 02:48:43PM +0100, Chris Angelico wrote:
>> List of strings. Take it straight from your Oracle interface and work
>> with it directly.
>
> Can I use this list in the following way ?
> subprocess_1 - run on list between 1 and 10000
> subprocess_2 - run on list between 10001 and 20000
> subprocess_3 - run on list between 20001 and 30000
> etc
> ...

Yep! You use list slicing. Working with smaller numbers for an example:

>>> ltrs=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
>>> ltrs[:10]
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
>>> ltrs[10:20]
['k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't']
>>> ltrs[20:]
['u', 'v', 'w', 'x', 'y', 'z']

(I actually created that list as "list(string.ascii_lowercase)" for
what that's worth.)

Slice operations are quite efficient.

Chris Angelico

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web