Overriding "__setattr__" of a module - possible?

Stephen Hansen me+list/python at ixokai.io
Wed Jun 16 01:35:13 EDT 2010


On 6/15/10 10:25 PM, John Nagle wrote:
> On 6/15/2010 9:33 PM, Stephen Hansen wrote:
>> Replacing the module with a class in sys.modules is really the only way
>> to fake the behavior.   
> 
>    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.

Can you show a bit of code that you're doing? I've never had much
trouble with it: but I'm not sure what you mean by that final statement.

You're attempting to turn "other" modules into faux-modules-as-classes?
I don't think you can do that successfully. The whole faux-module
strategy only works when the module is designed around that principle, I
think.

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20100615/1c8cf6a9/attachment.sig>


More information about the Python-list mailing list