Why doesn't Python have static variables?

后端 未结 9 2491
暗喜
暗喜 2020-11-27 14:48

There is a questions asking how to simulate static variables in python.

Also, on the web one can find many different solutions to create static variables. (Though I

9条回答
  •  无人及你
    2020-11-27 15:38

    The answer's pretty much the same as why nobody uses static methods (even though they exist). You have a module-level namespace that serves about the same purpose as a class would anyway.

提交回复
热议问题