[Python-Dev] Proof of the pudding: str.partition()

Delaney, Timothy (Tim) tdelaney at avaya.com
Thu Sep 1 01:36:00 CEST 2005


Fredrik Lundh wrote:

> the problem isn't the time it takes to unpack the return value, the
> problem is that it takes time to create the substrings that you don't
> need. 

I'm actually starting to think that this may be a good use case for
views of strings i.e. rather than create 3 new strings, each "string" is
a view onto the string that was partitioned.

Most of the use cases I've seen, the partitioned bits are discarded
almost as soon as the original string, and often the original string
persists beyond the partitioned bits.

Tim Delaney


More information about the Python-Dev mailing list