Skip to content

Commit

Permalink
Merge pull request #1112 from pyiron/attr
Browse files Browse the repository at this point in the history
Handle KeyError in __getattr__
  • Loading branch information
pmrv committed Jul 17, 2023
2 parents 9af7a68 + 6283cc5 commit bb0bbfe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyiron_atomistics/atomistics/structure/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ def __init__(
self.data[key] = val

def __getattr__(self, key):
return self.data[key]
try:
return self.data[key]
except KeyError:
raise AttributeError(key)

@property
def mass(self):
Expand Down

0 comments on commit bb0bbfe

Please sign in to comment.