Overriding "__setattr__" of a module - possible?

John Nagle nagle at animats.com
Tue Jun 15 22:43:29 EDT 2010


   Is it possible to override "__setattr__" of a module?  I
want to capture changes to global variables for debug purposes.

   None of the following seem to have any effect.

	modu.__setattr__ = myfn

	setattr(modu, "__setattr__", myfn)

	delattr(modu, "__setattr__")

				John Nagle



More information about the Python-list mailing list