Python Programming - Polymorphism - Discussion

Discussion Forum : Polymorphism - General Questions (Q.No. 10)
10.
What is the purpose of the __iter__() method in Python classes in the context of polymorphism?
To create a new instance of the class
To customize the behavior when an instance is deleted
To customize the behavior when the iter() function is called on an instance
To access superclass attributes directly
Answer: Option
Explanation:
The __iter__() method is used to customize the behavior when the iter() function is called on an instance of the class, allowing for polymorphic behavior.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.