Why don't strings share data in Python?

Erno Kuusela erno-news at erno.iki.fi
Wed Apr 17 01:01:48 EDT 2002


In article <87n0w37z0n.fsf at mathdogs.com>, Mike Coleman
<mkc+dated+1021607974.93924d at mathdogs.com> writes:

| I almost thought I might be able to use NumPy arrays, as it looks
| like they do share data.  They're not hashable, though,
| unfortunately, which kills the usage I had in mind.

reminds me of the buffer object. you can have a buffer object
representing 'oba' if you do buffer('foobar', 2, 3). i believe this
does what you awnt memory management wise. the re module can work on
buffer objects, maybe some other things can too.

  -- erno



More information about the Python-list mailing list