import idea

Paul Prescod paul at
Thu Mar 2 23:38:02 CET 2000

I would suggest instead that you add an object to the globals dictionary
in your site setup. It could be called "mods" (for brevity). You would
hook up "mods.__getattr__" so that you would say:


You would use __import__ in mods.__getattr__

I thought about this once and it seemed pretty cool to me as a shortcut.
You could argue that we could dump the import statement...(but I

Having an explicit object as the root for the dynamically generated
package tree would be more Pythonic than having every module magically
appear in your global package namespace.

Package support needs more thinking through...

 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
"We still do not know why mathematics is true and whether it is
certain. But we know what we do not know in an immeasurably richer way
than we did. And learning this has been a remarkable achievement,
among the greatest and least known of the modern era." 
        - from "Advent of the Algorithm" David Berlinski

More information about the Python-list mailing list