Is there any "rules" regarding importing python modules within your own module? I mean, how does this affects the performance of the program?

For example, I have my own module named "sound".
At the top of the file sound.py I have:
import scipy

In the code I have:
import scipy, sound, etc

Now I have two instances of every function within scipy, e.g.
scipy.r_[a] = sound.scipy.r_[a]

Module importing is quite fast, but not instant. It takes some time, but it happens only once. My concern is whether I hold all these multiple instances of same function in the memory, and does this reduce the performance of my program.

In short, when creating a module, is it worthwhile to be careful and import only necessary functions, nothing more?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to