(I'm new to PonyORM. I understand I may be asking some nonsense)
I have a table Word, from which I'm selecting:
result = select(w for w in Word)
Then I can iterate through the table with a for loop:
for i in result:
print(i)
This works. But if I try calling next() on result,
for i in result:
print(i)
# skip every second element
a = next(result)
I get an error:
TypeError: 'Query' object is not an iterator
I thought I'd try calling iter() on result, to create an iterator. Then I can call next(result):
result = iter(result)
a = next(result)
for i in result: # <-- will crash here
print(i)
But then I get another error:
TypeError: 'QueryResultIterator' object is not iterable
In other words, this is an iterator that I can't iterate through (?). I am very confused about this problem.
I'm using Python3.6.8, and PonyORM 0.7.13. (let me know if you need more details)
(I'm new to PonyORM. I understand I may be asking some nonsense)
I have a table
Word, from which I'm selecting:Then I can iterate through the table with a for loop:
This works. But if I try calling
next()onresult,I get an error:
I thought I'd try calling
iter()onresult, to create an iterator. Then I can callnext(result):But then I get another error:
In other words, this is an iterator that I can't iterate through (?). I am very confused about this problem.
I'm using Python3.6.8, and PonyORM 0.7.13. (let me know if you need more details)