From 9d7a148f63053cd79fffd0bf0f4b282e7f79ef0d Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 11 Nov 2016 19:59:00 -0500 Subject: add caching decorator --- PyEmb.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'PyEmb.py') diff --git a/PyEmb.py b/PyEmb.py index a8f01248..80b9a8a5 100644 --- a/PyEmb.py +++ b/PyEmb.py @@ -5,6 +5,14 @@ import math import sys from copy import deepcopy +try: + from functools import lru_cache +except ImportError: + from backports.functools_lru_cache import lru_cache + +# simplify use of lru_cache decorator +def cache(*args, **kwargs): + return lru_cache(maxsize=None)(*args, **kwargs) class Point: -- cgit v1.2.3