# recache
Cache functions to speed up recursion
## install
From Pypi:
`python -m pip install recache`
From GitHub:
`python -m pip install git+https://github.com/donno2048/recache`
## Usage
```py
from recache import cache
def fib(n): # slow recursion
if n < 0: return None
if n <= 1: return 1
return fib(n - 1) + fib(n - 2)
@cache
def cfib(n): # fast recursion
if n < 0: return None
if n <= 1: return 1
return cfib(n - 1) + cfib(n - 2)
```
To see the exact timing see [The notebook](https://github.com/donno2048/recache/blob/master/fib.ipynb)
Raw data
{
"_id": null,
"home_page": "https://github.com/donno2048/recache",
"name": "recache",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Elisha Hollander",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/ef/81/3058a299ff4a6da8aa73450e3eaf2121e41e0edb6ccd829166a4141cec9e/recache-1.0.0.tar.gz",
"platform": "",
"description": "# recache\n\nCache functions to speed up recursion\n\n## install\n\nFrom Pypi:\n\n`python -m pip install recache`\n\nFrom GitHub:\n\n`python -m pip install git+https://github.com/donno2048/recache`\n\n## Usage\n\n```py\nfrom recache import cache\ndef fib(n): # slow recursion\n if n < 0: return None\n if n <= 1: return 1\n return fib(n - 1) + fib(n - 2)\n@cache\ndef cfib(n): # fast recursion\n if n < 0: return None\n if n <= 1: return 1\n return cfib(n - 1) + cfib(n - 2)\n```\n\nTo see the exact timing see [The notebook](https://github.com/donno2048/recache/blob/master/fib.ipynb)\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Cache functions to speed up recursion",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/donno2048/recache"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c265ca407bcbc279d5738e8c9fc9e88117546cb6e6e6b4684f1bcdeec619e2af",
"md5": "735c4b742e8057cd94d9ee87415610f9",
"sha256": "8f2d38ed3d2ecbab658802fee48e608a06c2cd478246d8ce157785055d7763b6"
},
"downloads": -1,
"filename": "recache-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "735c4b742e8057cd94d9ee87415610f9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2368,
"upload_time": "2021-03-28T20:15:37",
"upload_time_iso_8601": "2021-03-28T20:15:37.747823Z",
"url": "https://files.pythonhosted.org/packages/c2/65/ca407bcbc279d5738e8c9fc9e88117546cb6e6e6b4684f1bcdeec619e2af/recache-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ef813058a299ff4a6da8aa73450e3eaf2121e41e0edb6ccd829166a4141cec9e",
"md5": "379b44e3030d53e50d563fe3b3a32aec",
"sha256": "245e613d8bfb7b684b68ca33bb3092da994ff9634b16f5cbdb859fcbdd7257cd"
},
"downloads": -1,
"filename": "recache-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "379b44e3030d53e50d563fe3b3a32aec",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1430,
"upload_time": "2021-03-28T20:15:39",
"upload_time_iso_8601": "2021-03-28T20:15:39.007555Z",
"url": "https://files.pythonhosted.org/packages/ef/81/3058a299ff4a6da8aa73450e3eaf2121e41e0edb6ccd829166a4141cec9e/recache-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-03-28 20:15:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "donno2048",
"github_project": "recache",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "recache"
}