__iter__ method returns self?

while implementing the yrange function, why the self is returned from the iter method, as we have to return an iterator, it should have been the variable i.

Hey @nikhil_0406
The value I is just a number on which we need loop upon while printing or working on those values.
Whereas, the iter method converts that simple class into a iterable class and when we start lopping Or using the next functions it becomes and iterator and provides us with the values.

I hope this helps.

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.