I want to create python class with read only properties.
Please see this example:
class ClassProperty(object):
def __init__(self, getter):
self.getter = getter
def __get__(self, instance, owner):
return self.getter(owner)
class Constants(object):
@ClassProperty
def version(cls):
return '1.0.11'
So under this (cls)
word i have this message:
Usually first parameter of method is named self
So i wonder is i need to declare it this way:
class Constants(object):
@ClassProperty
def version(self):
return '1.0.11'
And in this way the message disappear