Doubt in iterable class

Why did we do this part:
def iter(self):
return self
and what is the meaning of return self

hey @ ,
this return self , means we are returning a reference of the class object . And doing the same in a iterator classes __iter__ method , by this we are converting our iterator class to iterable class for further looping purposes.

I hope this helped you :slightly_smiling_face:

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.