FEEDBACK WANTED: Type/class unification

Robin Becker robin at
Tue Aug 14 18:54:08 CEST 2001

In article <cp7kw6em6n.fsf at>, Guido van
Rossum <guido at> writes
>> I guess what I'm trying to get at is can getset be used to create a
>> readonly module level global or can it only be used for attributes.
>The getset descriptor works in cooperation with the default
>__getattr__ implementation.  When is requested, __getattr__
>looks up first; if this is found and it is a
>descriptor, the descriptor's __get__ is called to finish the
>__getattr__ request.  Ditto for __setattr__.
>If you could subclass modules (you can't yet in 2.2a1, but you will in
>2.2), you could do this for module attribute references, but global
>variable references don't go through __getattr__ and __setattr__ on
>the module -- they use the C APIs PyDict_GetItem and PyDict_SetItem
>and you can't override those.
>--Guido van Rossum (home page:

OK I'll bite. What's a module attribute? I naively thought that

makes X a global in M and also an attribute of module M? Obviously I'm
wrong. Are there things (apart from builtins etc) which are more global
than X in M's scope?
Robin Becker

More information about the Python-list mailing list