On Tue, Jun 12, 2007 at 08:10:26PM +1200, Greg Ewing wrote: > Phillip J. Eby wrote: > > ...at the cost of slowing down access to properties and __slots__, by > > adding an *extra* dictionary lookup there. > > Rather than spend time tinkering with the lookup order, > it might be more productive to look into implementing > a cache for attribute lookups. That would help with > method lookups as well, which are probably more > frequent than instance var accesses.
Was wondering the same; specifically, hijacking pep280 celldict appraoch for this. Downside, this would break code that tries to do PyDict_* calls on a class tp_dict; haven't dug extensively, but I'm sure there are a few out there. Main thing I like about that approach is that it avoids the staleness verification crap, single lookup- it's there or it isn't. It would also be resuable for 280. If folks don't much like the hit from tracing back to a cell holding an actual value, could always implement it such that upon change, the change propagates out to instances registered (iow, change a.__dict__, it notifies b.__dict__ of the change, etc, till it hits a point where the change doesn't need to go further). ~harring
pgphUjh4BMXhf.pgp
Description: PGP signature
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com