[Python-3000] Making more effective use of slice objects in Py3k (original) (raw)

Josiah Carlson jcarlson at uci.edu
Sun Aug 27 08:08:14 CEST 2006


"Jim Jewett" <jimjjewett at gmail.com> wrote:

With stringviews, you wouldn't need to be reindexing from the start of the original string. The idiom would instead be a generalization of "for line in file:"

while data: chunk, sep, data = data.partition() but the partition call would not need to copy the entire string; it could simply return three views.

Also, with a little work, having string views be smart about concatenation (if two views are adjacent to each other, like chunk,sep or sep,data above, view1+view2 -> view3 on the original string), copies could further be minimized, and the earlier problem with readline, etc., can be avoided.



More information about the Python-3000 mailing list