Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 53)
53.
What happens if a generator function contains a yield from iterable statement?
It yields each value from the iterable, delegating to it
It raises a StopIteration exception
It yields the entire iterable as a single value
It is a syntax error; yield from cannot be used with generators
Answer: Option
Explanation:
yield from iterable delegates the yielding to the iterable, yielding each value from the iterable.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.