How can you copy (clone) a string?

Aahz Maruch aahz at panix.com
Sun Oct 8 10:53:28 EDT 2000


In article <wzy9zz8pyx.fsf at sunshine.cs.uu.nl>,
Piet van Oostrum  <piet at cs.uu.nl> wrote:
>>>>>> aahz at panix.com (Aahz Maruch) (AM) writes:
>
>AM> Because it's normally considered immutable, and here you're using it in
>AM> a mutable way.  I just don't think it's Pythonic.
>
>It is not only normally considered immutable, it IS immutable, So you
>cannot use it in a mutable way.  I am just using it to implement a
>linked list. Nothing wrong with that.

Yeesh.  An immutable singly-linked reverse-descent list?  Anyway, you're
writing code that makes it *look* like you're dealing with a mutable
object [*], and while we deal with that all the time with numbers and
strings, I think it's a Bad Idea to do that when there are true mutable
objects available.

(I doubt I'll convince you, but I can at least hope to convince other
people.  Note that you're now confusing the issue by using "list" to
refer to a structure made out of tuples.)


[*] In case anyone has lost track, the code in question is

tuple_var = (tuple_var, value)
-- 
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"[I have a] windmill fetish."  --Darkhawk



More information about the Python-list mailing list