3 ms·
Do you mean to say that mutating globals is not commonly used? Because literally every import, class definition, or function definition that you make at top-le
by int_19h 1y ago
Do you mean to say that mutating globals is not commonly used?
Because literally every import, class definition, or function definition that you make at top-level is a global.
Now some people do in fact do all those things inside a function, too, and then call that function as the only thing that actually happens globally. And I've done such hacks myself to squeeze the last few % of perf out of CPython on the very rare occasions where you need to do that but dropping into C is not an option. But that's certainly not idiomatic Python.