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

Code refactoring #429

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Code refactoring #429

wants to merge 2 commits into from

Conversation

tosemml
Copy link

@tosemml tosemml commented Sep 5, 2023

Description

These slight code adjustments aim to enhance Pythonic quality by incorporating python str.join

Changelog description

Status

  • Code base linted
  • Ready to go

@loriab
Copy link
Collaborator

loriab commented Sep 7, 2023

Thanks for the suggestion, but I don't think these are equivalent.

>>> mol_string = ""
>>> for iatom in range(4):
...     mol_string += "He " + str(1.0 * iatom) + " 0.0 0.0\n"
... 
>>> mol_string
'He 0.0 0.0 0.0\nHe 1.0 0.0 0.0\nHe 2.0 0.0 0.0\nHe 3.0 0.0 0.0\n'
>>> 
>>> mol_string2 = " 0.0 0.0\n".join(["He " + str(1.0 * iatom) for iatom in range(4)])
>>> mol_string2
'He 0.0 0.0 0.0\nHe 1.0 0.0 0.0\nHe 2.0 0.0 0.0\nHe 3.0'

@tosemml
Copy link
Author

tosemml commented Sep 7, 2023

I fixed the bug, thanks for highlighting

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.

None yet

2 participants