In Python 3, `iterator.next()` was renamed to `iterator.__next__()` to clearly designate it as a magic method or dunder method, consistent with other protocols.
…PEP [3114] proposes that the next method be renamed to __next__ , consistent with all the other protocols in Python in which a method is implicitly called as part of a language-level protocol, and that a built-in function named next be introduced to invoke __next__ method, consistent with the manner in which other protocols are explicitly invoked.[1]