is importing redundantly harmful/wasteful?

python at sarcastic-horse.com python at sarcastic-horse.com
Tue Sep 16 14:37:30 EDT 2003


I'm writing a function and it needs to use regular expressions and the
super-fantastic mx.DateTime module.  The first lines after the doc string
in the function are:

    import re, mx.DateTime

I'll be using this function in a bunch of different programs.  Some of
those programs might need re and mx.DateTime for other tasks.

In some cases, I'll be redundantly importing these modules.  Should I care
if I'm re-importing re and mx.DateTime even after they've been imported? 
Does python do some sort of checking for this stuff or do I need to?





More information about the Python-list mailing list