3 ms·
regarding the speed issue: i looked at python 2.7 - here the interpreter is creating a dictionary for each function frame, now local variables are looked up by
by MichaelMoser123 12y ago
regarding the speed issue: i looked at python 2.7 - here the interpreter is creating a dictionary for each function frame, now local variables are looked up by name of variable in this dictionary ! (globals have their separate namespace dictionary)
(i made a tracing tool that traces a python program and prints out all accessed variables - it actually makes use of this by-name-lookup-feature
http://mosermichael.github.io/cstuff/all/projects/2015/02/24/python-backtrace.html http://mosermichael.github.io/cstuff/all/projects/2015/02/24... )
i think that's quite wasteful, fixing variable access so that it is by some internal index and not by name would probably be a big improvement, even without changing the global interpreter lock.