Facundo Batista wrote:

A thread in PyAr raised the question that, considering that strings
are immutable, why a slice of a string is a copy and not a reference
to a part of that string.

Because it would make it too easy to accidentally keep
a large string alive via a reference to a small part
of it.

Some way of explicitly requesting a view into another
string might be desirable, but it shouldn't be the
default behaviour for string slicing.

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to