You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The CellCollection.cells property uses @cached_property and returns a mutable list of the collection's cells.
Because the list is cached, modifying the returned list affects subsequent accesses to collection.cells, even though the underlying collection (_cells) remains unchanged.
Expected behavior
Modifying the list returned by collection.cells should not modify the result of subsequent accesses or affect operations on the collection.
I think I begin to understand the claimed bug. Closing it might be premature. However, the proper fix would be to to let the property return a tuple rather than a list. Since this is a bug fix, the fact that it might be break stuff does not matter for semver.
Activity
quaquel commentedon Nov 20, 2026
Look at the docstring for
CellCollection: "An immutable collection of cells". So, I don't see a bug here.quaquel commentedon Nov 20, 2026
I think I begin to understand the claimed bug. Closing it might be premature. However, the proper fix would be to to let the property return a tuple rather than a list. Since this is a bug fix, the fact that it might be break stuff does not matter for semver.
fix(discrete_space): return a tuple from CellCollection.cells (mesa#4142
fix(discrete_space): make CellCollection.cells return a tuple (#4142) (…