source: immutablelistpy/immutablelist/AbstractImmutableList.py@ 241

Last change on this file since 241 was 241, checked in by wouter, 3 years ago

ooops, type issue in immutablelist.

File size: 672 bytes
Line 
1from decimal import Decimal
2from typing import TypeVar
3
4from immutablelist.ImmutableList import ImmutableList
5
6
7E = TypeVar('E')
8class ItemIterator:
9 def __init__(self, l:ImmutableList[E]):
10 self._l = l
11 # member variable to keep track of current index
12 self._index = 0
13 def __next__(self):
14 '''Returns the next value from team object's lists '''
15 if self._index >= self._l.size():
16 # End of Iteration
17 raise StopIteration
18 val=self._l.get(self._index)
19 self._index += 1
20 return val
21
22class AbstractImmutableList(ImmutableList[E]):
23 def __iter__(self):
24 return ItemIterator(self)
Note: See TracBrowser for help on using the repository browser.