Reply to Chris:
Also it's rarely the case where it can become thread unsafe suddenly. 1 / 10*something chances. Because I've repeatedly run a thread-unsafe code and have not encountered thread unsafe state yet. GIL executes the code to a very good extent. And is it hypothetically even possible to have thread unsafe state that can affect functions? Because locals of the different functions are different. Since the variable will be loaded by LOAD_FAST it will look into locals for the static variable and both locals will differ. The only dangerous code is op=. Because this depends on the current value of static variable that can make the function go to an undefined state.