On Thu, 19 Jul 2007, Kent Johnson wrote:

> Attribute lookup seems to have gotten better since Beazley wrote; here
> is a test program that uses three ways to access math.sqrt - module
> attribute, global name, local name. Note that in the third version, all
> three names (sqrt, d, i) are local:
 . . .
> Sample output:
> 745.465993881
> 561.167001724
> 369.343996048

I'm surprised the difference between the second and third versions is so 
dramatic.  I get a result consistent with that (although you obviously 
have a much faster CPU than I!).

Why is that so much faster?  A smaller namespace to look through?  Or the 
search being short-cut by finding in in the local space and therefore not 
needing to search the global?  Something else?

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to