|
|
|
|
|
by fovc
3643 days ago
|
|
Not sure how this timeit is running, but there are two things going on: Local name lookups are done as array indexing; whereas global lookups are done as cascading dictionary lookups. And the attribute lookup also is a dictionary search. On instances, looking up a method defined in a super class involves failed lookups in the instance and all the base classes in a definition. In a hot inner loop, definitely worth cutting out |
|
Isn't that what the .pyc files are for, so that it doesn't need to perform lookups like this at runtime?