Why don't strings share data in Python?

Mike Coleman mkc+dated+1021607974.93924d at mathdogs.com
Wed Apr 17 00:03:04 EDT 2002


Tim Peters <tim.one at comcast.net> writes:
> There are many reasons, but one of them is invisible to Python users:
> because Python is intended to play nice with C libraries, all Python strings
> end with a \0 byte.

Well, that's certainly a bug in the ointment.

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.

Maybe I'll just buy more RAM...  ;-)

Mike



More information about the Python-list mailing list