Skip to content

Commit

Permalink
use filter for emptiness check
Browse files Browse the repository at this point in the history
  • Loading branch information
Corvince committed Feb 5, 2021
1 parent 674cd14 commit 49db41c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,7 @@ def iter_cell_list_contents(
An iterator of the contents of the cells identified in cell_list
"""
for (x, y) in cell_list:
content = self.grid[x][y]
if not content == self.default_val():
yield content
return filter(None, (self.grid[x][y] for x, y in cell_list))

@accept_tuple_argument
def get_cell_list_contents(
Expand Down

0 comments on commit 49db41c

Please sign in to comment.