NDOJ/judge/utils/cachedict.py
Phuoc Dinh Le e66b57ad5f Revert "Change comment style (#67)"
This reverts commit 411f3da45e.
2023-05-20 08:53:27 +09:00

8 lines
217 B
Python

class CacheDict(dict):
def __init__(self, func):
super(CacheDict, self).__init__()
self.func = func
def __missing__(self, key):
self[key] = value = self.func(key)
return value