[Python-Dev] Require loaders set package and loader (original) (raw)

Barry Warsaw barry at python.org
Mon Apr 16 00:38:29 CEST 2012


On Apr 15, 2012, at 02:12 PM, Glyph wrote:

Twisted has such a thing, mostly written by me, called twisted.python.modules.

Sorry if I'm repeating myself here, I know I've brought it up on this list before, but it seems germane to this thread. I'd be interested in getting feedback from the import-wizards participating in this thread in case it is doing anything bad (in particular I'd like to make sure it will keep working in future versions of Python), but I think it may provide quite a good template for a standard API. The code's here: <http://twistedmatrix.com/trac/browser/trunk/twisted/python/modules.py> The API is fairly simple.

from twisted.python.modules import getModule e = getModule("email") # get an abstract "module" object (un-loaded)

Got a PEP 8 friendly version? :)

-Barry



More information about the Python-Dev mailing list