Overriding "__setattr__" of a module - possible?
Stephen Hansen
me+list/python at ixokai.io
Wed Jun 16 12:31:11 EDT 2010
On 6/16/10 1:23 AM, Christian Heimes wrote:
>> There aren't any; modules do not follow the class object protocol. They
>> are simple types with a __dict__ (which you can't change, either, so no
>> replacing it with a dict that implements __setattr__).
>
> You are wrong, my friend. :)
>
> Modules follow the new style class and instance protocol. Modules aren't
> classes but instances of the internal module type. Since you can't
> overwrite magic methods on instances of new style classes you can't
> overwrite __setattr__ on module level, too.
Well, fine, be that way, all right and correct and shiznit. :)
--
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/20100616/c9fb5fec/attachment-0001.sig>
More information about the Python-list
mailing list