
Feb. 28, 2011
12:20 p.m.
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. -- Steven