You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ffx/bin/prod.py

33 lines
518 B
Python

import itertools
class c1():
def getYield():
for i in range(3):
yield i
class c2():
def getYield():
for i in range(5):
yield i
class c3():
def getYield():
for i in range(7):
yield i
sc = {}
sc['y1'] = c1
sc['y2'] = c2
sc['y3'] = c3
sc_list = [(k,v) for k,v in sc.items()]
y = []
for p in itertools.product(*[v.getYield() for k,v in sc_list]):
z = {}
for i in range(len(p)):
z[sc_list[i][0]] = p[i]
y.append(z)
print(y)