On Wed, Sep 15, 2021 at 4:06 PM Guido van Rossum <gu...@python.org> wrote:

> [SNIP]
> Reminder about how for-loops work:
>
> This:
>
> for x in seq:
>     <body>
>
> translates (roughly) to this:
>
> _it = iter(seq)
> while True:
>     try:
>         x = next(_it)
>     except StopIteration:
>         break
>     <body>
>

And if anyone wants more details on this, I have a blog post about it at
https://snarky.ca/unravelling-for-statements/ .
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/5C7IIVHYX6A25ERQT4RJ3MM6AOXZVBAZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to