Reading a file, sans whitespace

Jeff Epler jepler at unpythonic.net
Sun May 23 20:47:28 EDT 2004


It looks like the impact of not compiling should be fairly small.
sre.split calls sre._compile() which has a 100-entry cache.  The total
overhead is something like 3 function calls and a dictionary lookup.

You might switch from in-line REs to compiled ones to get the last
little bit of speed out of some code, but IMO the big reason is for
code clarity and to re-use the same RE in multiple places without
duplicating the RE string.

Jeff




More information about the Python-list mailing list