ark at research.att.com
Tue Aug 13 02:57:47 CEST 2002
>> Doesn't string qualify?
Steve> Only before you subclass it to optimize slicing.
Sorry -- my question was too terse. I'll elaborate:
My understanding is that because strings are immutable, any Python
implementation is permitted to disregard object identity when
it computes string values. So, if I write
a = "hello, world"
b = a[0:5]
the implementation is permitted to cause a and b to refer to two
different subsequences of the same part of memory. I understand that
present implementations do not behave this way in general, but I don't
think there's any basis for assuming that no implementation will ever
behave this way. Am I right?
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark
More information about the Python-list