"Paul Prescod" <[EMAIL PROTECTED]> wrote: > Yes, thanks for the clarification. From a type theory point of view there is > nothing stopping string + view returning a view always (even if it is a view > of a new string) but that would have very poor performance characteristics.
It depends. Assume single-segment views (that's what I've been implementing). If you have two non-adjacent views, or a view+string (for non-empty strings), etc., you need to take the time to construct the new string, that's a given. But once you have a string, you could return either the string, or you could return a full view of the string. The performance differences are fairly insignificant (I was not able to measure any). Up until this morning I was planning on writing everything such that constructive manipulation (upper(), __add__, etc.) returned views of strings. While I still feel it would be more consistant to always return views, returning strings does let the user know that "this operation may take a while" by virtue of returning a string. - Josiah _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
