mirror of
https://github.com/django/django.git
synced 2025-10-06 16:50:52 +00:00
[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:
parent
5b27e6f64b
commit
0c198b85a3
5 changed files with 6 additions and 5 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue