Module/package hierarchy and its separation from file structure

Peter Schuller peter.schuller at infidyne.com
Tue Jan 29 13:48:59 CET 2008


> You can also put, in animal/__init__.py:
>  from monkey import Monkey
> and now you can refer to it as org.lib.animal.Monkey, but keep the  
> implementation of Monkey class and all related stuff into  
> .../animal/monkey.py

The problem is that we are now back to the identity problem. The class
won't actually *BE* org.lib.animal.Monkey. Perhaps manipulating
__module__ is enough; perhaps not (for example, what about
sys.modules?). Looks like I'll just live with putting more than I
would like in the same file.

-- 
/ 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