LazyDict¶ class deepfos.lib.utils.LazyDict(dict=None, /, **kwargs)¶ 元素延迟初始化的字典 元素的值只会在使用时被计算 >>> def call(*args): ... print('calc') ... return sum(args) >>> ld = LazyDict() >>> ld['a'] = (call, 1, 2, 3) >>> ld['b'] = (call, 4, 5, 6) >>> ld['a'] calc 6 >>> ld['a'] 6 参见 LazyList