(gs)
| 1916 | # each slot depend on the values iterated at previous slots. |
| 1917 | |
| 1918 | def simple_conjoin(gs): |
| 1919 | |
| 1920 | values = [None] * len(gs) |
| 1921 | |
| 1922 | def gen(i): |
| 1923 | if i >= len(gs): |
| 1924 | yield values |
| 1925 | else: |
| 1926 | for values[i] in gs[i](): |
| 1927 | for x in gen(i+1): |
| 1928 | yield x |
| 1929 | |
| 1930 | for x in gen(0): |
| 1931 | yield x |
| 1932 | |
| 1933 | # That works fine, but recursing a level and checking i against len(gs) for |
| 1934 | # each item produced is inefficient. By doing manual loop unrolling across |