E.g., I have:
def readDb():
# Fetch a lot of data from db, spends a lot time
...
return aList
def calculation():
x = readdb()
# Process x
...
return y
In the python interpreter,
each time I run calculation()
it takes a lot of time to re-read the database, which is unnecessary.
How can I store the result from readdb()
to avoid this reducdant process?
Edit:
I found a similar question here but I don't quite know the answer
Save functions for re-using without re-execution