FEEDBACK WANTED: Type/class unification

Robin Becker robin at
Sat Aug 18 10:00:15 CEST 2001

In article <cp1ymadub3.fsf at>, Guido van
Rossum <guido at> writes
>Robin Becker <robin at> writes:
>> >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
>> X=3
>> ....
>> 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?
>It's purely a syntactical question.  When used from inside the module,
>it's a global.  When used from the outside as M.X, it's a module
>--Guido van Rossum (home page:
Ok so is the implication that external references to M.X could possibly
be controllable by get/set mechanisms, but inside M such controls
wouldn't work? Inside M you could presumably import M and work with M.X.
Robin Becker

More information about the Python-list mailing list