Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cell.agents is prone to create bugs #2682

Open
quaquel opened this issue Feb 11, 2025 · 2 comments
Open

cell.agents is prone to create bugs #2682

quaquel opened this issue Feb 11, 2025 · 2 comments

Comments

@quaquel
Copy link
Member

quaquel commented Feb 11, 2025

In the new discrete spaces, you can easily access the agents in a given cell, via cell.agents. However, if you modify this list by, e.g., removing agents from it, you mess up everything because you are modifying which agents reside in which cell. The obvious solution is that cell.agent should return a copy of the list of agents, rather than the actual list. This removes the potential for side effects.

@Sahil-Chhoker
Copy link
Contributor

Sahil-Chhoker commented Feb 12, 2025

Why was cell.agents not made into a property?

@quaquel
Copy link
Member Author

quaquel commented Feb 12, 2025

That is indeed the solution I am thinking of (and update add_agent and remove_agent). I'll put in a PR later today.

why was it not done before? because you typically discover this stuff while using it again after not having used it a few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants