# Incremental Combination Generation from Laggy Generators

**URL:** <https://discuss.python.org/t/incremental-combination-generation-from-laggy-generators/85052>\
**Category:** Python Help\
**Created:** [March 18, 2025, 6:49pm UTC](https://discuss.python.org/t/incremental-combination-generation-from-laggy-generators/85052 "2025-03-18T18:49:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![harrison](https://avatars.discourse-cdn.com/v4/letter/h/3e96dc/32.png) [@harrison](https://discuss.python.org/u/harrison)\
**Post date:** [March 18, 2025, 8:02pm UTC](https://discuss.python.org/t/incremental-combination-generation-from-laggy-generators/85052/2 "2025-03-18T20:02:03Z")

</div>

It looks like the problem is that `itertools.product` fully [consumes](https://docs.python.org/3/library/itertools.html#itertools.product) its iterables before it starts to yield results. I found a [discussion](https://discuss.python.org/t/a-product-function-which-supports-large-infinite-iterables/5753) from a few years ago about adding another function that would yield results incrementally, but it doesn’t look like it went anywhere. You might could look at the suggested implementation and see if it would work for you, or it was also noted that sympy has a [function](https://docs.sympy.org/latest/modules/utilities/iterables.html#sympy.utilities.iterables.iproduct) that can do this.

In general, though, I think the answer is that there isn’t a particular design pattern that you’re missing. If `itertools` doesn’t quite work the way you need it to, you may need to write your own version of its functions, or find other implementations that do work for you.

---

_[View the full topic](https://discuss.python.org/t/incremental-combination-generation-from-laggy-generators/85052)._
