mesa
mesa copied to clipboard
space: Improve coord_iter return values
Currently, coord_iter returns a tuple of self.grid[row][col], row, col. It results in this code in the Schelling example
https://github.com/projectmesa/mesa/blob/9dfe32e6b64b3ecdef719bba57d3624a41b21e85/examples/schelling/model.py#L66-L68
The numbered accessor is not semantic. We should either
- return
self.grid[row][col], (row, col)i.e. group the position into 1 object. This is helpful if we want to generalize the space to 3+ dimensional grid - return a dictionary
{"content": ..., "position": ...}. This is more semantic, but is slower