One Python 2.1 idea

rturpin at rturpin at
Tue Dec 26 09:51:43 EST 2000

In article <929n9c013m3 at>,
  "Alex Martelli" <aleaxit at> wrote:
> No implicit caching.

Has there been some discussion about caching? If done
well, the vast majority of references would reach
their object's attribute or method for the cost of a
couple of integer compares and array fetches. This
should be an order of magnitude faster than string
lookup in a dictionary. This especially benefits
method invocation, since that costs a failed lookup
to the instance dictionary, and a successful lookup
in the class dictionary. That's almost enough to
scare me away from methods!

Most work in a Python program involves object methods
or attributes. (At least, this is the case in my
programs. ;-) Increasing the speed of reference to
these should have appreciable benefit, across the
board. Yeah, it would make the code a bit more
complex to maintain. But this isn't a special case --
it is a general mechanism central to how Python works.


Sent via

More information about the Python-list mailing list