1
0
forked from VimPlug/jedi

The memoize decorator doesn't need to magically cache generators as lists.

This makes no sense at all. Explicit is better than implicit.
This commit is contained in:
Dave Halter
2017-09-26 18:36:10 +02:00
parent a0a438fe6f
commit faa2d01593

View File

@@ -4,8 +4,6 @@
- ``CachedMetaClass`` uses ``_memoize_default`` to do the same with classes.
"""
import inspect
_NO_DEFAULT = object()
@@ -40,8 +38,6 @@ def _memoize_default(default=_NO_DEFAULT, evaluator_is_first_arg=False, second_a
if default is not _NO_DEFAULT:
memo[key] = default
rv = function(obj, *args, **kwargs)
if inspect.isgenerator(rv):
rv = list(rv)
memo[key] = rv
return rv
return wrapper