Closed brookehus closed 4 years ago
Will review tonight!
Yeah. If instead of a deep copy I use the previous
self.bond_pairs = self._adj_backbone_pairs
then this is a reference, not a new list. Then, when I extend self.bond_pairs
later, in the old version self._adj_backbone_pairs
also gets extended. I was trying to debug something and wanted to check if all the adjacent backbone pairs were correctly calculated, but the hidden attribute was getting my custom pairs too because of the lack of deep copy.
Gotcha - nice catch! LGTM
Development:
[ ] Add tests
Checks:
nosetests
I was debugging some scripts I have and ran into issues (1) understanding my own logic in
feature/statistics
and (2) having something weird happen with some hidden attributes. I've added adeepcopy
to solve this, which replaces former line 164:self.bond_pairs = self._adj_backbone_pairs
with new line 176:
self.bond_pairs = copy.deepcopy(self._adj_backbone_pairs)
.Besides that and
import copy
, the only other changes are some more documentation.