Do Python iterators have a hasnext method?
hasnext
No, there is no such method. The end of iteration is indicated by an exception. See the documentation.