Problems with string and lists (searching and replaceing)

jblazi jblazi at hotmail.com
Mon Sep 22 10:20:02 EDT 2003


On Mon, 22 Sep 2003 12:49:24 +0000, Alex Martelli wrote:

> Basically, the change from "x[y]=z" to "x=x[:y]+z+x[y+1:]" is just
> not "traumatic" enough, in my opinion, to warrant considering this
> a seriously complicated problem ("not seem simple at all").

Of course, you are right. The possibility to create a new string dawned
upon me later when I was already lying in my bed...
Of course, in this case a lot of activity takes place in the background
(memory objects have to be allocated and deallocated) and if efficiency
played a rôle... In this case it does not and your solution is the right
one.
In C strings are mutable and so you can work in situ but usually those
zero terminated strings have their disadvantages as well...

Thank you for your help.

--
JB

Ceterum censeo: wxPython should replace Tkinter.




More information about the Python-list mailing list