You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ueberzug/ueberzug/pattern.py

13 lines
345 B
Python

class LazyConstant:
def __init__(self, function):
self.value = None
self.function = function
def __get__(self, instance, owner):
if self.value is None:
self.value = self.function()
return self.value
def __set__(self, instance, value):
raise AttributeError("can't set attribute")