[Python-ideas] str.split with multiple individual split characters

Steven D'Aprano steve at pearwood.info
Mon Feb 28 12:20:42 CET 2011

Stefan Behnel wrote:
> Steven D'Aprano, 28.02.2011 11:23:
>> Guido van Rossum wrote:
>>> It's so easy to do this using re.split() that it's not worth the added
>>> complexity in str.split().
>> Easy, but slow. If performance is important, it looks to me like re.split
>> is the wrong solution. Using Python 3.1:
> You forgot to do the precompilation. Here's what I get:

The re module caches the last 100(?) patterns used, so it only needs 
compiling once. The other 49,999 times it will be fetched from the cache.


More information about the Python-ideas mailing list