18.12.21 13:18, me@chenjt.com пише:
It might be a good idea to use "@staticproperty" to solve this problem. "@staticproperty" is a decorators, it mix the @staticmethod and @property. Then the static property has getter and setter.
classmethod supersedes staticmethod. It was not clearly known when they were introduced, but now we see that there is very few use cases for staticmethod which cannot be replaced by classmethod (actually only one specific case). If it would be known in advance staticmethod would be not added. So you can use a combination of @classmethod and @property. class Data: @classmethod @property def imagesTotal(cls): return 10 There are some issues with help() and unittest.mock. They may not work as you expected.