-- http://mail.python.org/mailman/listinfo/python-list
I have been programing in python for a while now and by in large love
it. One thing I don't love though is that as far as I know iterators
have no has_next type functionality. As a result if I want to iterate
until an element that might or might not be present is found I either
wrap the while loop in a try block or break out of a for loop. Since an
iterator having an end is not actually an exceptional case and the for
construct is really for iterating though the entirety of a list both of
these solutions feel like greasy workarounds and thus not very
pythonic. Is there something I am missing? Is there a reason python
iterators don't have has_next functionality? What is the standard
solution to this problem?
- Has Next in Python Iterators Kelson Zawack
- Re: Has Next in Python Iterators Felipe Bastos Nunes
- Re: Has Next in Python Iterators Steven D'Aprano
- Re: Has Next in Python Iterators Alexander Gattin
- Re: Has Next in Python Iterators Kelson Zawack
- Re: Has Next in Python Iterators Stefan Behnel
- Re: Has Next in Python Iterators Jussi Piitulainen
- Re: Has Next in Python Iterators Hrvoje Niksic
- Re: Has Next in Python Iterators Paul Rudin
- Re: Has Next in Python Iterators Ian
- Re: Has Next in Python Iterators Ben Finney