阅读背景:

Python中的静态类变量,不为每个实例复制

来源:互联网 

I need a way to create a static class variable in Python that only the class will have. I can't afford this variable to be created over and over again for each instance, because the target class variable will be a huge read-only data structure. Each instance must be able to access it for read-only purposes throught the class, but since it's a giant bulk of data and there will be thousands instances, I can't afford that each instance will create another copy of this data structure again. I need a way to create a static class variable




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: