Skip to content

Commit 49a35a3

Browse files
committed
ActiveClass: make it iterable
1 parent 3f12912 commit 49a35a3

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

dss/dss_capi_gr/IActiveClass.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ def Count(self):
2727
def __len__(self):
2828
return self._lib.ActiveClass_Get_Count()
2929

30+
def __iter__(self):
31+
n = self.First
32+
while n:
33+
yield self
34+
n = self.Next
35+
3036
@property
3137
def First(self):
3238
'''(read-only) Sets first element in the active class to be the active DSS object. If object is a CktElement, ActiveCktELment also points to this element. Returns 0 if none.'''

dss/dss_capi_ir/IActiveClass.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ def Count(self):
2727
def __len__(self):
2828
return self._lib.ActiveClass_Get_Count()
2929

30+
def __iter__(self):
31+
n = self.First
32+
while n:
33+
yield self
34+
n = self.Next
35+
3036
@property
3137
def First(self):
3238
'''(read-only) Sets first element in the active class to be the active DSS object. If object is a CktElement, ActiveCktELment also points to this element. Returns 0 if none.'''

0 commit comments

Comments
 (0)