Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 75)
75.
How does the generator.throw(StopIteration, value) method affect a running generator?
It stops the generator and raises a StopIteration exception with the specified value
It continues the generator's execution with the specified value
It has no effect on the running generator
It raises a ValueError with the specified value
Answer: Option
Explanation:
generator.throw(StopIteration, value) stops the generator and raises a StopIteration exception with the specified value.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.