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

Updated get_constituent_citations #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FusionSandwich
Copy link
Contributor

Corrected the spelling of consituent to constituent, added doc strings, and updated get_constituent_citations to separate citations with a ",".

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch - I've offered some options that avoid the successive append() approach. Sometimes it's necessary to explicitly append something in a loop, but here a python list comprehension may be a better choice.

Returns:
citation (str): A comma-separated string of citations.
"""
citation_list = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the way you have simplified the following lines, you might just want a list comprehension and skip the explicit loop.

Suggested change
citation_list = []
citation_list = [mat.metadata["citation"] for mat in materials]

Could even do it in one line, but maybe too fancy and impact readability:

    return ", ".join([mat.metadata["citation"] for mat in materials])

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

Successfully merging this pull request may close these issues.

2 participants