Skip to content

Commit

Permalink
Adding the option to iterate over group members
Browse files Browse the repository at this point in the history
  • Loading branch information
stammler committed Jan 12, 2024
1 parent 6689ecc commit 798d859
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion simframe/frame/abstractgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,18 @@ def __str__(self):
def __repr__(self):
return self.__str__()

def __iter__(self):
"""
This is to make it possible to iterate over the non-hidden
members of a group.
"""
return ((name, member)
for name, member in self.__dict__.items()
if not name.startswith("_"))

def update(self, *args, **kwargs):
"""Function to update the object.
"""
Function to update the object.
Ths functions calls the heartbeat instance of the object.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion simframe/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ py3.install_sources(python_sources, subdir: 'simframe')
subdir('frame')
subdir('integration')
subdir('io')
subdir('utils')
subdir('utils')

0 comments on commit 798d859

Please sign in to comment.