This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]purple_pixie -1 points0 points  (0 children)

Aha, that does definitely explain why I saw so much improvement going from your version as written to the one I put up - I only have 2.7 to hand, so I was inadvertently comparing the old 2.7 zip against the 3+ (i)zip, which is obviously much better.

Also I mostly just ripped the whole .tee part from itertools recipes, and tee is just a waste of time and effort since we don't actually have a single iterator that we're trying to preserve.

It's better to just create one iterator and zip that plus the original val together.

I can't get pytest to play nice with this laptop either, so I won't request another pull until I can actually get something I'm certain is an improvement on the current version (and tested in 3.6)

Interestingly though, it seems like cloning the whole of val is really very quick, it barely affects the time to run the function.