[py3] Replace filter/lambda by list comprehensions

This is more idiomatic and avoids returning a list on Python 2 and
an iterator on Python 3.
This commit is contained in:
Aymeric Augustin 2012-08-14 14:22:08 +02:00
parent 5b27e6f64b
commit 0c198b85a3
5 changed files with 6 additions and 5 deletions

View file

@ -387,7 +387,7 @@ class Options(object):
predicates.append(lambda k, v: not k.field.rel.is_hidden())
cache = (self._related_objects_proxy_cache if include_proxy_eq
else self._related_objects_cache)
return filter(lambda t: all([p(*t) for p in predicates]), cache.items())
return [t for t in cache.items() if all(p(*t) for p in predicates)]
def _fill_related_objects_cache(self):
cache = SortedDict()