Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment: I was also typing a similar reply and Steve explained it better :) Just to add there is a note on implicit next call on a for loop in the documentation.
https://docs.python.org/3/reference/expressions.html#generator.__next__ > Starts the execution of a generator function or resumes it at the last > executed yield expression. When a generator function is resumed with a > __next__() method, the current yield expression always evaluates to None. The > execution then continues to the next yield expression, where the generator is > suspended again, and the value of the expression_list is returned to > __next__()’s caller. If the generator exits without yielding another value, a > StopIteration exception is raised. > This method is normally called implicitly, e.g. by a for loop, or by the > built-in next() function. ---------- nosy: +xtreak _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35725> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com