Код: Выделить всё
mysettings.pysettings = {
'expensive1' : expensive_to_compute(1),
'expensive2' : expensive_to_compute(2),
...
}
< /code>
Я бы хотел, чтобы эти значения были рассчитаны при обращении к ключам: < /p>
from mysettings import settings # settings is only "prepared"
print(settings['expensive1']) # Now the value is really computed.
< /code>
Это возможно? Как?
Подробнее здесь: https://stackoverflow.com/questions/166 ... ary-lazily