On Sun, Jan 08, 2006 at 07:35:53AM -0800, Ralf W. Grosse-Kunstleve wrote: > IIUC, "self" is first looked up in the local dictionary. No. Local variables are stored in a tuple (more or less,) and indexed by, er, index. Loading a local variable onto the stack is a fairly fast operation. > Please try the code below to see the performance impact. As an alternative to a > copy/paste exercise try this: > > wget http://cci.lbl.gov/~rwgk/python/self_lookup.py > python self_lookup.py > The output with Python 2.4.1/Fedora3/Opteron is: > > loop_function: 13.10 > loop_class: 17.11 The main difference isn't the lookup of 'self', it's the attribute retrieval of 'x' from 'self'. -- Thomas Wouters <thomas at xs4all.net> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4