Overriding "__setattr__" of a module - possible?

Michele Simionato michele.simionato at gmail.com
Wed Jun 16 02:05:55 EDT 2010


On Jun 16, 7:25 am, John Nagle <na... at animats.com> wrote:

>     OK, working on this.  I can make a module make itself into a
> fake class, but can't yet do it to other modules from outside.
>
>                                         John Nagle


I think you can with something like

import module
sys.modules[module.__name__] = FakeModule(vars(module))



More information about the Python-list mailing list