Add utils.collect_iterable decorator.

This commit is contained in:
Andrey Golovizin 2014-08-13 15:19:44 +02:00
parent 9155905398
commit e8d7d1f4d1

View file

@ -29,3 +29,10 @@ def cached_property(fun):
ret = self._cache[fun] = fun(self)
return ret
return property(get)
def collect_iterable(func):
@functools.wraps(func)
def collect(*args, **kwargs):
return list(func(*args, **kwargs))
return collect