Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 93)
93.
What happens if the generator.close() method is called on a generator?
It stops the generator and raises a StopIteration exception
It raises a GeneratorExit exception inside the generator
It has no effect on the running generator
It raises a ValueError
Answer: Option
Explanation:
generator.close() has no effect on the running generator. It is typically used to signal that the generator can be closed.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.