[Tutor] any cons to using a module of functions?

Che M pine508 at hotmail.com
Fri Feb 3 06:05:13 CET 2012


I have a bunch of functions that do various utility-type tasks in an application (such as prettifying date strings, etc.), and they are used in many modules.  Much of the time, I have just been lazily copying and pasting the functions into whichever modules need them.  I realize that is very bad form and I should refactor, and so I am beginning to put these functions in their own module so that I can import the module and its functions when I need it; they will all be in one place and only only place.

My question is about resources.  Let's say I have the module, myUtils.py, and I import it into every other module that will need one or more of the functions within it.  Is this in any way costly in terms of memory?  (since each time I import myUtils.py I import *all* the functions, instead of in the cut&paste approach, where I just run the functions I need).

I'm fairly sure this is not at all an issue, but I just want to understand why it's not.  

Thanks.



 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120203/56afa650/attachment.html>


More information about the Tutor mailing list