2 ms·
I don't know if any python implementations avoid creating unnecessary closures, but you are right that I meant a specific implementation: CPython. I am not too
by omaranto 16y ago
I don't know if any python implementations avoid creating unnecessary closures, but you are right that I meant a specific implementation: CPython.
I am not too familiar with python in the present and maybe the following has changed: there isn't really a definition of the language, but the documentation (which was written for the main implementation, but is the closest thing to a definition of the language) does mention that declaring a function creates a function object (closure) and assigns it to a local variable. Of course, an implementation should probably feel free to contradict the documentation when the difference is not observable.