Automatic Python import mechanism: autoimp initial release
Connelly Barnes
connellybarnes at yahoo.com
Sun Jun 11 09:44:04 CEST 2006
Author: Connelly Barnes
License: Public domain.
I got sick of writing "import X" in Python. So, I created the module autoimp,
which imports all modules automatically:
>>> from autoimp import *
>>> os.stat('.')
>>> Image.open('test.bmp')
>>> pylab.plot([1,2],[3,4])
>>> scipy.linalg.eig([[1,2],[3,4]])
>>> ...
Thus one no longer needs to write "import X". It would take too long to load
every module when one writes "from autoimp import *", so the imported modules
are actually proxy objects which lazily load when they are first used. The
modules are found by searching sys.path. This module will probably save me
a lot of keystrokes; I hope you enjoy it.
Blog post, with source code link:
http://barnesc.blogspot.com/2006/06/automatic-python-imports-with-autoimp.html
Comments, bugs, patches to: connellybarnes at domain yahoo.com.
Thanks,
Connelly
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Python-announce-list
mailing list