I was trying to use for loops with iterable objects (implementing iter method or len and getitem methods). I discovered that currently batavia does not accept objects implementing the sequence protocol (len and getitem methods).
The following code works on normal python but not on batavia :
class Test:
def __init__(self, l):
self.l = l
def __len__(self):
return len(self.l)
def __getitem__(self, index):
return self.l[index]
t = Test([1 ,2, 3, 6])
total = 0
for i in t:
total = total + i
print(i, total)
print('Done.')
I'm using python3.5 in a virtual environment running on macOS 10.14.1.
I was trying to use for loops with iterable objects (implementing iter method or len and getitem methods). I discovered that currently batavia does not accept objects implementing the sequence protocol (len and getitem methods).
The following code works on normal python but not on batavia :
I'm using python3.5 in a virtual environment running on macOS 10.14.1.