Josiah Carlson wrote: > If every operation on a view returned a string copy, then what would be > the point of the view in the first place?
String views would have all the same methods as a real string, so you could find(), index(), etc. while operating efficiently on the original data. To my mind this is preferable to having little-used optional arguments on an easily-forgotten subset of the string methods: you only have to remember one thing (how to create a view) rather than a bunch of random things. For some things, such as partition(), it might be worth having a variant that returned views instead of new strings. But it would be named differently, so you'd still know whether you were getting a view or not. On the other hand, this would introduce another random set of things to remember, i.e. which methods have view-returning variants. Although maybe it would be easier to remember them, being different methods rather than optional arguments to existing methods. Their existence would show up more clearly under introspection, for example. I'm not personally advocating one approach or the other here -- just pointing out an alternative that might be more acceptable to the BDFL. -- Greg _______________________________________________ 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
