Reputation: 1466
Is it possible to run python code in Eclipse (PyDev) and use variables computed in previously executed code (similar to using console and interpret code in real time as we enter it)?
Details: I want to use python for experimenting with signal processing and to the signal are applied 2 computationally intensive filters in a row. Each filter take some time and it would be nice to remember the result of the first filter without the need to recompute it at each launch.
Upvotes: 0
Views: 118
Reputation: 23500
Or just do: Password Protection Python
import pickle
reading a "cache" / database:
with open('database.db', 'rb') as fh:
db = pickle.load(fh)
adding to it:
db = {}
db['new_user'] = 'password'
with open('database.db', 'wb') as fh:
pickle.dump(db, fh)
Upvotes: 1
Reputation: 33076
Decorate your functions with Simple Cache and it will save parameters/result hash to disk. I should point out that it works only when arguments are of an immutable type (no lists, dictionaries...). Otherwise, you could handle cache results with the API exposed by Simple Cache or use pickle to serialize results to disk and load it later (which is what simple_cache does, actually).
Upvotes: 0