Tim> I'm actually starting to think that this may be a good use case for Tim> views of strings i.e. rather than create 3 new strings, each Tim> "string" is a view onto the string that was partitioned.
How would this work? One of the advantages of the current string is that the underlying data is NUL-terminated, so when passing strings to C routines no copying is required. Suppose I executed scheme, _, rest = "http://www.python.org/".partition(':') As a Python programmer I'd get back what look like three strings: "http", ":", and "//www.python.org/". If each of them was a view onto part of the original string, only the last one would truly refer to a NUL-terminated sequence of characters. If I then wanted to see what scheme's value compared to, the string's comparison method would have to recognize that it wasn't truly NUL-terminated, copy it, call strncmp() or whatever underlying routine is used for string comparisons. (Maybe string comparisons are done inline. I'm sure there are some examples where the underlying C string routines are called.) OTOH, maybe that would work. Perhaps we should try it. Skip _______________________________________________ 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