Re: modifying small chunks from long string

2005-11-14 Thread Steven D'Aprano
Tony Nelson wrote: > >Can I get over this performance problem without reimplementing the > >whole thing using a barebones list object? I though I was being "smart" > >by avoiding editing the long list, but then it struck me that I am > >creating a second object of the same size when I put the modi

Re: modifying small chunks from long string

2005-11-14 Thread MackS
Thank you all for your great help. One of the few things better than python is the knowledgeable community around it. : ) Regards, Mack -- http://mail.python.org/mailman/listinfo/python-list

Re: modifying small chunks from long string

2005-11-14 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "MackS" <[EMAIL PROTECTED]> wrote: > Hello everyone > > I am faced with the following problem. For the first time I've asked > myself "might this actually be easier to code in C rather than in > python?", and I am not looking at device drivers. : ) > > This progr

Re: modifying small chunks from long string

2005-11-14 Thread Bengt Richter
On 13 Nov 2005 22:57:50 -0800, "MackS" <[EMAIL PROTECTED]> wrote: >Hello everyone > >I am faced with the following problem. For the first time I've asked >myself "might this actually be easier to code in C rather than in >python?", and I am not looking at device drivers. : ) > >This program is mea

Re: modifying small chunks from long string

2005-11-14 Thread Steven D'Aprano
Replying to myself... the first sign of madness *wink* Steven D'Aprano wrote: > size = 1024*1024*20 # 20 MB > original = "A" * size > copy = [None] * size > for i in range(size): > copy[i] = original[i].lower() > copy = ''.join(copy) Do you notice the premature optimization? Rather than

Re: modifying small chunks from long string

2005-11-14 Thread Steven D'Aprano
MackS wrote: > This program is meant to process relatively long strings (10-20 MB) by > selectively modifying small chunks one at a time. ... > Can I get over this performance problem without reimplementing the > whole thing using a barebones list object? Is that a problem? Are you using stri

modifying small chunks from long string

2005-11-13 Thread MackS
Hello everyone I am faced with the following problem. For the first time I've asked myself "might this actually be easier to code in C rather than in python?", and I am not looking at device drivers. : ) This program is meant to process relatively long strings (10-20 MB) by selectively modifying