FEEDBACK WANTED: Type/class unification
robin at jessikat.fsnet.co.uk
Sat Aug 18 10:00:15 CEST 2001
In article <cp1ymadub3.fsf at cj20424-a.reston1.va.home.com>, Guido van
Rossum <guido at python.org> writes
>Robin Becker <robin at jessikat.fsnet.co.uk> 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: http://www.python.org/~guido/)
>> 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?
>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: http://www.python.org/~guido/)
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.
More information about the Python-list