But what about `pip install more-itertools`? Hopefully you become comfortable with that a lot faster than 3 years in.
more-itertools Is kind of a special case (or at least different case), as it’s a collection of handy general purpose utilities, rather than a package designed to address particular problems, like , say requests or pytest (probably the first two packages I suggest newbies install)
In fact, itertools itself is a bit odd that way — it’s not clear what types of problems it might address:
You want to look In itertools If you need to iterate through something in a non-trivial, but probably common enough that others need to do it too way.
Honestly, I often forget to look there when I should.
Which brings us back to the OP's question:
What is a good way to loop through and iterable and apply an operation to it when you don't want to create a new iterable?
I doubt anyone is going to find consume() in itertools (even if it was built in) and know it use it to solve this use case.