>>>>> Terry Hancock <[EMAIL PROTECTED]> (TH) wrote: >TH> He's got to be talking about runtime name-binding. In >TH> other words, when you refer to:
>TH> a.spam >TH> the Python interpreter actually knows you labeled that attribute 'spam', >TH> and the string is stored in a.__dict__ , so you can also access it as >TH> getattr(a, 'spam') >TH> etc. >TH> I'm pretty sure this is what string "internment" is for, though, and >TH> that such lookups are optimized out pretty much whenever possible. In the case of getattr(a, 'spam') a string comparison for 'spam' has to be done. AFAIK, in the case of a.spam the string 'spam' has been interned, so that no string comparison is necessary at lookup, only a pointer comparison. Due to hash collisions probably multiple comparisons could be necessary. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list