Python Forum

Full Version: discard one from an iterator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have a iterator in a variable which was iterated until some match was encountered. next i want to iterate it in a very different loop. before that, i want to just discard one iteration. will next(my_iterator) do that?

edit:

i am very accustomed to programming in C where such loops step through arrays using pointers where all i would need to do between the two loops is increment the pointer. but that's not how it's done in Python. i'm drawing a blank trying to figure it out.
Yes.