QCEngine icon indicating copy to clipboard operation
QCEngine copied to clipboard

Code refactoring

Open tosemml opened this issue 2 years ago • 2 comments

Description

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

Changelog description

Status

  • [ ] Code base linted
  • [ ] Ready to go

tosemml avatar Sep 05 '23 07:09 tosemml

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'

loriab avatar Sep 07 '23 04:09 loriab

I fixed the bug, thanks for highlighting

tosemml avatar Sep 07 '23 04:09 tosemml