-
Notifications
You must be signed in to change notification settings - Fork 33
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
Standardize dict, list, and array inputs #617
Comments
The purpose of the This would not change the code interface to a function like We should raise a more informative error in the real implementation. imo it would also be nice from a user perspective to have the error raise from the function I called if possible, rather than an internal one that I've never seen. Unrelated (I can open a separate issue if needed), but can we please not use |
Great, I will work on implementing this.
Correct. It should be backwards-compatible, but allow more diverse input.
Yes. This is a great suggestion.
Yeah, I agree, we really shouldn't do this 😬. Unfortunately, it is in other modules so if you could open an issue to address this library-wide, that would be amazing. |
NetworkX solves this problem with the concept of an nbunch. As I'm sure yall know, most functions accept an nbunch, so they have abstracted the requirement of "one, many, or all nodes" away into a single kind of object that is used throughout their entire interface. I find that pretty elegant, and not unlike the solution @nwlandry is suggesting. However, I don't know how it is implemented. I don't know if it is a FWIF, I think the first of these (using Protocol or some other version of structural typing) is the most elegant. More info here. |
In
uniform_hypergraph_configuration_model
, it only accepts dict inputs. I propose that we create a function calledto_array
or something like this where it will standardize the inputs so that functions which accept a sequence can accept several types of input.The text was updated successfully, but these errors were encountered: