Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 28)
28.
What is the purpose of the generator.__iter__() method?
It returns the iterator object associated with the generator
It initializes the generator
It returns the generator itself
It is not a valid method for generators
Answer: Option
Explanation:
generator.__iter__() returns the generator itself. Generators are their own iterators in Python.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.