[Python-Dev] Startup time
Skip Montanaro
skip@pobox.com
Wed, 7 May 2003 14:05:06 -0500
Jeff> In encodings.__init__.py, the only use of re is for the
Jeff> normalize_encoding function. It could potentially be replaced with only
Jeff> string operations:
...
Jeff> .. or the import of re could be moved inside normalize_encoding.
I don't know if this still holds true, but at one point during the 2.x
series I think it was pretty expensive to perform imports inside functions,
much more expensive than in 1.5.2 at least (maybe right after nested scopes
were introduced?). If that is still true, moving the import might be false
economy.
Skip
"Some people, when confronted with a problem, think 'I know, I'll use regular
expressions.' Now they have two problems." -- Jamie Zawinski