You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the second way works on native objects as I know (tested with list). And following example, which then also works, displays only every second entry:
# range(0, 10, 2) in a more complex shape:result=list(range(10))
result=iter(result)
foriinresult:
print(i)
a=next(result)
Got the same error as you did in your second example while working with Pony today. I will see if I can create a PR fixing this, should be easy to do.
EDIT: Did not know that before, but implementing the __iter__ method to an Iterator as well (and not just to an Iterable) is even a requirement by Python, so that first calling iter(iterable) and then using it in a for loop is possible without hassle.
(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)
The text was updated successfully, but these errors were encountered: