[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021年9月16日 11:04:15 -0700

On Wed, Sep 15, 2021 at 4:06 PM Guido van Rossum <[email protected]> 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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/5C7IIVHYX6A25ERQT4RJ3MM6AOXZVBAZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to