Python 2.6+ and 3.* have next(), but pre-2.6 only offers the object.next method. Is there a way to get the next() style in pre-2.6; some “def next():” construction perhaps?
Python 2.6+ and 3.* have next(), but pre-2.6 only offers the object.next method. Is
Share
(
throw = object()works too, but this generates better docs when inspecting, e.g.help(next).Noneis not suitable, because you must treatnext(it)andnext(it, None)differently.)