Search code examples
pythoniterator

hasnext() for Python iterators?


Do Python iterators have a hasnext method?


Solution

  • No, there is no such method. The end of iteration is indicated by an exception. See the documentation.