-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add new get elements method to lattice to return elements by family or class. #102
Conversation
Thanks @T-Nicholls for addressing #100! I prefer simple names, so having just one get_elements function is fine. However I am not so comfortable with the idea that a str could be either a class name or a FamName. What if someone calls an element 'ap' (a 2 letter-acronym is easy to find), do a get_element('ap') and get all Aperture elements instead? Maybe one could say that giving a str to get_elements will just address FamName? Also throwing an exception if there is no element matching the str seems a bit excessive. Returning an empty list is also fine, don't you think? |
I agree with @abdomit on the "string" option for the key: it should refer to I also think that we should get an empty list in case no element matches. For me it is not an error. Otherwise:
Final note: this function ends up with either For me, using any of these single lines looks as simple and clear as a function call. But I have nothing against the function! |
Thank you both for the feedback, I agree with everything said so I'll make the changes. |
@lfarv @abdomit |
@T-Nicholls: I would only suggest that you add an optional verbose mode to prevent being flooded by messages when calling get_elements with a str as parameters. Otherwise it looks nice to me. Thanks again. |
No problem, I will add a |
Hi @T-Nicholls. What happened to this branch? It looked ready for merging, but I do not see it any more… |
@lfarv |
A first draft of my proposed solution to #100.
Perhaps having two separate
get_elements_by_family
andget_elements_by_class
would be more elegant than my current implementation; what is everyone's opinion on this?I would welcome any feedback or improvements that anyone might have.