This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author SilentGhost
Recipients SilentGhost, akuchling, amaury.forgeotdarc, belopolsky, benjamin.peterson, bjourne, donlorenzo, ezio.melotti, foom, georg.brandl, mortenlj, mrabarnett, pitrou, rsc, swamiyeswanth, timehorse, zanella
Date 2011-01-13.16:48:32
SpamBayes Score 0.0010771577
Marked as misclassified No
Message-id <>
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 ( 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:48SilentGhostsetrecipients: + 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:48SilentGhostsetmessageid: <>
2011-01-13 16:48:32SilentGhostlinkissue2650 messages
2011-01-13 16:48:32SilentGhostcreate