-
Notifications
You must be signed in to change notification settings - Fork 944
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
AgentSet.get is hardcoded to raise AttributeError for agents with missing attribute #2045
Comments
@EwoutH Add handle_undefined parameter with default "raise_exception". |
Generally sounds good. Maybe
Feel free to start implementing this and open a (draft) PR. |
Hi @rht, |
@quaquel what's your view on this? |
It probably would be better to work from #2067, where there is code. I am fine with the basic idea of adding some fallback value that is user-specifiable. This is analogous to python's |
What's the problem this feature will solve?
This is #2044 (comment) turned into an issue. Currently,
AgentSet.get
requires member agents to possess the attribute(s) it specifies. This may not be convenient if user wants to quickly get the result and intentionally want to specify undefined attribute(s) asNone
.Describe the solution you'd like
What I have in mind is to add an extra optional argument called
handle_undefined
, which defaults to"raise_exception"
(raise AttributeError). The other option would be"fallback_none"
to fallback toNone
without raising an exception. Though user might want to fallback tonp.nan
instead ofNone
, so this idea still needs further iteration.The text was updated successfully, but these errors were encountered: