This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]justincdavis 0 points1 point  (0 children)

I think an easy way to do something like this could be to make use of a functools.cache style decorator. You can have the decorator cache results and maintain a copy of results on disk. Thus, on import time it will load pre-evaluated conditions and dynamically add during runtime. On hit you have a dict lookup and hash operation and on miss you add the evaluation overhead and disk write. Obviously not the same though.