[Python-Dev] 2.3 startup speed?

Jeremy Hylton jeremy@zope.com
11 Jul 2003 12:04:18 -0400

On Fri, 2003-07-11 at 11:50, Skip Montanaro wrote:
>     Jeremy> I'd like to avoid importing re at all if it isn't needed.  If
>     Jeremy> you write a simple script and care about it's startup time, it
>     Jeremy> would be nice if Python didn't require you to load re just to
>     Jeremy> ignore Overflow warnings.
> You lost me.  If the pattern is a simple string, only the code in the
> warnings module needs re and the functions which need it can import it
> themselves.  I've been running with the attached diff for some time with no
> problems (since the last time we discussed this topic).  Why does the user
> of the warnings module need to import re?

I'm lost, too.

If a warning gets generated, you would need to have re imported to
filter the warning.

If a user writes a short script that generates warnings that is ignored
(OverflowWarning or PendingDeprecationWarning), the re module will need
to be imported.  My change allows scripts that don't actually need re to
run without importing it, even if they do generate ignored warnings.