Module/package hierarchy and its separation from file structure

Peter Schuller peter.schuller at infidyne.com
Tue Jan 29 07:51:58 EST 2008


> You can reassign the class's module:
>
> from org.lib.animal.monkey import Monkey
> Monkey.__module__ = 'org.lib.animal'
>
>
> (Which, I must admit, is not a bad idea in some cases.)

Is there a sense whether this is truly a supported way of doing this,
in terms of not running into various unintended side-effects? One
example would be sys.modules that I mentioned in the previous
post. Another, possibly related, might be interaction with the import
keyword and its implementation.

I will probably have to read up more on the semantics of __import__
and related machinery.

-- 
/ Peter Schuller

PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller at infidyne.com>'
Key retrieval: Send an E-Mail to getpgpkey at scode.org
E-Mail: peter.schuller at infidyne.com Web: http://www.scode.org




More information about the Python-list mailing list