Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 76)
76.
What happens if the generator.throw(ValueError) method is called without specifying an exception value?
It raises a ValueError with a default message
It raises a TypeError
It has no effect on the running generator
It raises a StopIteration exception
Answer: Option
Explanation:
Calling generator.throw(ValueError) without specifying an exception value raises a TypeError, as the exception value is mandatory.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.