Re: Python name lookups / Interning strings

2005-10-11 Thread Terry Hancock
On Tuesday 11 October 2005 05:36 pm, Dave wrote: > What exactly does it mean to "intern" a string? For very simple strings such as "A" and for strings used as identifiers (I think), Python creates a permanent object during byte-code compilation. Thereafter, any time that string value occurs in th

Re: Python name lookups / Interning strings

2005-10-11 Thread Martin v. Löwis
Dave wrote: > What exactly does it mean to "intern" a string? "exactly" it means to place lookup the string in the global interning dictionary. If an entry is found, then interning yields the string in the interning dictionary. If the string is not found, it is added to the interning dictionary, a

Re: Python name lookups / Interning strings

2005-10-11 Thread Dave
--- [EMAIL PROTECTED] wrote: > lookdict_string is used for most lookups of the form > obj.attr > because they are never found to have non-string keys > entered or searched. > > Furthermore, most of these string keys are > "interned", > which I believe makes the check > if (ep->me_ke

Re: Python name lookups

2005-10-10 Thread Steve Holden
Dave wrote: > Hello All, > > As far as I understand, Python deals with a lot of > string objects, i.e. it looks up all names. Is there a > way to find out how many name lookup operations take > place in a Python program? Is it the name lookup > operation or hash operation that degrades performance

Re: Python name lookups

2005-10-10 Thread jepler
On Mon, Oct 10, 2005 at 03:02:30PM -0700, Dave wrote: > Hello All, > > As far as I understand, Python deals with a lot of > string objects, i.e. it looks up all names. Is there a > way to find out how many name lookup operations take > place in a Python program? Is it the name lookup > operation o

Python name lookups

2005-10-10 Thread Dave
Hello All, As far as I understand, Python deals with a lot of string objects, i.e. it looks up all names. Is there a way to find out how many name lookup operations take place in a Python program? Is it the name lookup operation or hash operation that degrades performance? What function does Pytho