[Python-Dev] Skiping searching throw dictionaries of mro() members.

Sokolov Yura falcon at intercable.ru
Wed Sep 14 20:11:03 CEST 2005

Phillip J. Eby wrote:

> At 09:12 PM 9/14/2005 +0400, Sokolov Yura wrote:
>> We could cash looks by this way:
>> Store with a class its version. Every time after creation when we change
>> a class
>> (add,remove or chage class member, including __base__, __bases__ and 
>> mro) ,
>> we increase the version number. Lets call it VERSION
> FYI, there is already a mechanism for new-style classes that notifies 
> subclasses of changes to the base class; this mechanism could be used 
> to push cache flushes downward, rather than doing version checking 
> upward.
I didn't know it. So, if this thing works, it should be used.

Another think. I do not really know, how emplemented scopes,
but could this caching be applied to a scope realisation?
So we "derive" current scope from his outer and cache all lookups, that 
goes out of this scope.
Top scope is "derived" from a module and module it self "derived" from 
I think, there not many different deep upper lookups in current 
programs, but many reapeating,
 and not often we change outer scope, so cache will be fine.

More information about the Python-Dev mailing list