Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 22)
22.
What is the purpose of the generator.send(None) expression?
It sends a None value to the generator
It initializes the generator
It restarts the generator from the beginning
It resumes the generator's execution from the last yield
Answer: Option
Explanation:
generator.send(None) is used to resume the execution of a generator from the last yield statement. It is equivalent to calling next(generator).
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.