-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add section explaining 'yield' in list comp/generator exp #32
Comments
Ah, I went through the SO thread and the bug report but unfortunately couldn't come up with a simple and short explanation. So I think for the time being, it's better to link to the resources you shared. Meanwhile I'll try to come up with a simpler explanation with the help of examples. |
@chris-rands Thanks for your suggestion. I've added this snippet in #45, and will try my best to add a detailed explanation for the same. |
@satwikkansal Thank you for incorporating my suggestion and apologies for not responding before; I don't think I can provide a better explanation than that given in the links but it might be worth adding that this behaviour described may change because this really is a bug and not a feature. As the bug report states, for PyPy these constructs now raise a |
Update: see the more recent discussion on the bug report bugs.python.org/issue10544; this syntax will sometimes raise a |
These examples illustrate what for me is one of the most confusing behaviours in the whole of Python:
A relevant SO question and bug report
The text was updated successfully, but these errors were encountered: