Rememberer is a tool to help your functions remember their previous results.
Project description
rememberer
Rememberer is a tool to help your functions remember their previous results.
The advantage of this package compared to other memoization packages is that it will remember the result of the function even if you kill the program and restart it.
It will also remember the result even if you restart the python interpreter because it uses a pickle file to store the results.
Installation
pip install rememberer
Usage
from rememberer import rem
def add(a, b):
import time
time.sleep(3)
return a + b
rem(add, 1, b=2) # this will take 3 seconds
rem(add, 1, b=2) # this will take ~0 seconds
You can use it as a decorator as well:
from rememberer import rem_dec
@rem_dec
def add(a, b):
import time
time.sleep(3)
return a + b
add(1, b=2) # this will take 3 seconds
add(1, b=2) # this will take ~0 seconds
If you want to clear the cache, you can use the forget method:
from rememberer import forget
forget(add, 1, b=2)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rememberer-0.1.6.tar.gz.
File metadata
- Download URL: rememberer-0.1.6.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f223acf28c07076dd526368da4f037f7f674ad82915e13fe20657bdf873b514b
|
|
| MD5 |
b97e629bb4e19274d28217e60c6e8d54
|
|
| BLAKE2b-256 |
b020d791872b5202f0cc2a330b88a63cbafc490a1fc68273f9d5900fb77d2902
|
File details
Details for the file rememberer-0.1.6-py3-none-any.whl.
File metadata
- Download URL: rememberer-0.1.6-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d77e29be21f5b5bcdc035cb6fb0668125ae243a5efb2fc18cb03f4a833210bb
|
|
| MD5 |
b93d2facde21b0ec745f197c1092cfaf
|
|
| BLAKE2b-256 |
3583081e721ef8d65ce9d19afc36395ef5812aef801251397175b906f85b0bfd
|