- 1
Can someone explain the __iter__and __next__?
2 Answers
0
If you create your own containers for example you want to make them iterateable. To achieve that these objects have to implement a __iter__ function which will return the iterator of your object (can be the same object again) this iterator has to have the function __next__ which gets called every step of the iteration to retrieve the next element.
0
thanks