Skip to content

ytyng/python-memoized-property

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

This repository is deprecated.

You use functools.cached_property.

python-memoized-property

memoized property decorator in python

property デコレータの代わりに使う。 関数の実行を1度だけ行い、計算結果をインスタンス変数として格納しておく。 再度呼び出しが行われた場合、関数をコールせず、インスタンス変数から結果を返す。

slots が定義されているとうまくいかないかもしれない。

class Hoge(object):

    @memoized_property
    def calc(self):
        some cord....

About

memoized property decorator in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages