[Python-Dev] Instance variable access and descriptors (original) (raw)
Brian Harring ferringb at gmail.com
Tue Jun 12 13:13:01 CEST 2007
- Previous message: [Python-Dev] Instance variable access and descriptors
- Next message: [Python-Dev] Instance variable access and descriptors
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.python.org/pipermail/python-dev/attachments/20070612/435ee92d/attachment.pgp
- Previous message: [Python-Dev] Instance variable access and descriptors
- Next message: [Python-Dev] Instance variable access and descriptors
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]