Message126181
James, I think the setup statement should have been:
"import re\ndef escape(s):\n return re.sub(r'([][.^$*+?{}\\|()])', r'\\\1', s)")"
note the raw string literals.
The timings that I got after applying file20388 (http://bugs.python.org/file20388/issue2650.diff) were:
>PCbuild\python.exe -m timeit -s "import re, string" "re.escape(string.printable)"
10000 loops, best of 3: 63.3 usec per loop
>python.exe -m timeit -s "import re, string" "re.escape(string.printable)"
100000 loops, best of 3: 19.3 usec per loop |
|
Date |
User |
Action |
Args |
2011-01-13 16:48:48 | SilentGhost | set | recipients:
+ SilentGhost, akuchling, georg.brandl, amaury.forgeotdarc, belopolsky, foom, pitrou, rsc, timehorse, benjamin.peterson, zanella, donlorenzo, ezio.melotti, bjourne, mortenlj, mrabarnett, swamiyeswanth |
2011-01-13 16:48:48 | SilentGhost | set | messageid: <1294937328.42.0.0833275900517.issue2650@psf.upfronthosting.co.za> |
2011-01-13 16:48:32 | SilentGhost | link | issue2650 messages |
2011-01-13 16:48:32 | SilentGhost | create | |
|