Python Programming - Generators - Discussion
Discussion Forum : Generators - General Questions (Q.No. 42)
42.
How does the
generator.throw(ValueError, "message")
method differ from raise ValueError("message")
when used with a generator?
Answer: Option
Explanation:
generator.throw(ValueError, "message")
is used to raise an exception inside the generator, while raise ValueError("message")
is used outside the generator to raise an exception.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers