fix some unused code
This commit is contained in:
parent
81430fe632
commit
fc7a6c6f4a
@ -13,7 +13,7 @@ class DeferredDict(dict, Generic[Key, Value]):
|
|||||||
|
|
||||||
```
|
```
|
||||||
bignum = my_slow_function() # slow function call, would like to defer this
|
bignum = my_slow_function() # slow function call, would like to defer this
|
||||||
numbers = Library()
|
numbers = DeferredDict()
|
||||||
numbers['big'] = my_slow_function # no slow function call here
|
numbers['big'] = my_slow_function # no slow function call here
|
||||||
assert(bignum == numbers['big']) # first access is slow (function called)
|
assert(bignum == numbers['big']) # first access is slow (function called)
|
||||||
assert(bignum == numbers['big']) # second access is fast (result is cached)
|
assert(bignum == numbers['big']) # second access is fast (result is cached)
|
||||||
@ -38,7 +38,7 @@ class DeferredDict(dict, Generic[Key, Value]):
|
|||||||
self[k] = v
|
self[k] = v
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return '<Library with keys ' + repr(set(self.keys())) + '>'
|
return '<DeferredDict with keys ' + repr(set(self.keys())) + '>'
|
||||||
|
|
||||||
def set_const(self, key: Key, value: Value) -> None:
|
def set_const(self, key: Key, value: Value) -> None:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user