[Python-ideas] Modules could behave like new-style objects

Christian Heimes lists at cheimes.de
Fri Apr 3 10:56:11 CEST 2009

Zac Burns schrieb:
> I would like to see modules behave more like new-style objects. One
> should be able to add properties, descriptors, __getattr__, and such.
> One common use case for me is implementing wrapper modules that
> populate dynamically (like the ctypes.windll object - except as a
> module).

Modules are new style classes and they behave exactly like new style
classes. Perhaps you have missed the point that modules are *instances*
of the module type? As you probably know one can't overwrite magic
methods like __getattr__ on the instance. :)


More information about the Python-ideas mailing list