Overriding "__setattr__" of a module - possible?

Ian Kelly ian.g.kelly at gmail.com
Wed Jun 16 18:56:39 EDT 2010


On Wed, Jun 16, 2010 at 3:38 PM, John Nagle <nagle at animats.com> wrote:
> That just leaves things in a state where even "sys" and "import"
> are undefined.

Say what?  It works fine for me.

>>> import proxy_mod
>>> proxy_mod.f()
1
>>> proxy_mod.a = 2
setting a=2
>>> proxy_mod.f()
2
>>> proxy_mod.sys
<module 'sys' (built-in)>

Ian



More information about the Python-list mailing list