Python's Performance

Terry Hancock hancock at anansispaceworks.com
Mon Oct 10 17:18:00 EDT 2005


On Saturday 08 October 2005 01:54 pm, Fredrik Lundh wrote:
> Dave wrote:
> > Yes, I would like to know how many internal string operations are done inside
> > the Python interpreter.
> 
> when you're doing what?
> 
> how do you define "internal string operations", btw?

He's got to be talking about runtime name-binding.  In
other words, when you refer to:

a.spam

the Python interpreter actually knows you labeled that attribute 'spam',
and the string is stored in a.__dict__ , so you can also access it as

getattr(a, 'spam')

etc.

I'm pretty sure this is what string "internment" is for, though, and
that such lookups are optimized out pretty much whenever possible.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list