Python Programming - Generators - Discussion
Discussion Forum : Generators - General Questions (Q.No. 87)
87.
How does the
generator.throw(StopIteration)
method differ from raise StopIteration
when used with a generator?
Answer: Option
Explanation:
generator.throw(StopIteration)
is used to raise a StopIteration
exception inside the generator, while raise StopIteration
is used outside the generator to signal the end of iteration.
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