modeler: __getattr__ for modules

Wiktor Sadowski art at
Sun Jun 22 01:15:00 CEST 2003

Some people have been asking for modeler.pyd for Python2.3.
It's available now at:


Modeler enables dynamic module-attribute creation/access by simply adding
a __gettattr__ function to a module. Modeler doesn't replace modules
with class instances,actually it doesn't make any changes to modules.

More details and windows binaries for  Python2.2 , Python2.3
can be found at:

Examples of simple module-class-factory and importing two or more modules
from one dll :

As for the source code:
I will try to make it available later this month.

Have fun,
Wiktor Sadowski

add to
import modeler
def __getattr__(thismod,name):
        if name in thismod.__dict__.keys():
                return thismod.__dict__[name]
           # in more useful cases:
           #return anAttr 
           return "Default Attr"
Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> from dynmod import whatever1,whatever2
>>> whatever1
'Default Attr'
>>> whatever2
'Default Attr'
>>> import dynmod
'Default Attr'
>>> dynmod.spam
'Default Attr'

More information about the Python-list mailing list