Skip to content

Commit

Permalink
getattr faster than hasattr
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonBurns committed Feb 4, 2022
1 parent 2a5271c commit dd49f1e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions AIMSim/ops/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ def to_rdkit(self):
return self.rdkit_

def check_init(self):
if hasattr(self, "numpy_") or hasattr(self, "rdkit_"):
return True
return False
return getattr(self, "numpy_", None) is not None or getattr(self, "rdkit_", None) is not None

def _set_morgan_fingerprint(self, molecule_graph, radius, n_bits, **kwargs):
"""Set the descriptor to a morgan fingerprint.
Expand Down

0 comments on commit dd49f1e

Please sign in to comment.