brython-dev / brython

Brython (Browser Python) is an implementation of Python 3 running in the browser
BSD 3-Clause "New" or "Revised" License
6.39k stars 510 forks source link

zip() doesn't implement the iterator interface #1621

Closed pamelafox closed 3 years ago

pamelafox commented 3 years ago

It appears that zip() doesn't implement the full iterator interface-

english = ["one", "two", "three"]
español = ["uno", "dos", "tres"]
zip_iter = zip(english, español)
eng, esp = next(zip_iter)
print(eng, esp)

In https://brython.info/tests/editor.html, that results in:

Traceback (most recent call last): File https://brython.info/tests/editor.py, line 119, in run exec(src, ns) File , line 4, in AttributeError: 'zip' object has no attribute 'next'

It's fine if you wrap zip in iter(), but that should not be necessary since zip should return an iterator, and does so in standard Python. <completed in 19.00 ms>

PierreQuentel commented 3 years ago

Thanks @pamelafox !