Python Programming - Objects - Discussion

Discussion Forum : Objects - General Questions (Q.No. 29)
29.
In Python, what is the purpose of the __iter__ method in a class?
To define iteration behavior
To calculate the length of an object
To delete the class object
To serialize the object
Answer: Option
Explanation:
The __iter__ method is used to define how an object should behave when used in an iteration context, such as with a for loop.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.