The next
builtin calls the __next__
hook method. So, range
objects have a well defined __iter__
, but not a well-defined __next__
.
iterable objects have __iter__
defined, iterator objects have well defined __next__
(typically with an __iter__
method which simply returns self
).