Redundant importing of modules

Jshgwave jshgwave at yahoo.com
Mon Dec 20 20:36:45 EST 2010


When writing a function that uses a module such as NumPy, it is tempting to include the statement "import numpy" or "import numpy as np" in the definition of the function, in case the  function is used in a script that hasn't already imported NumPy.

That could lead to the script issuing the "import numpy" command more than once.

Does Python know to disregard redundant "import" commands?





 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101220/2bc4c058/attachment-0001.html>


More information about the Python-list mailing list