計算に時間がかかる静的メソッドをPythonで作成しましたが、一度だけ計算してから、計算された値を返したいです。私は何をすべきか ?ここにサンプルコードがあります:
class Foo:
@staticmethod
def compute_result():
#some time taking process
Foo.compute_result() # this may take some time to compute but store results
Foo.compute_result() # this method call just return the computed result