0
這部分程序做什麼(在Nubela's guthub上找到)?Python函數說明
def product(*args, **kwds):
"""
for py2.6< support (they lack itertools lib)
- http://docs.python.org/2/library/itertools.html#itertools.permutations
"""
pools = map(tuple, args) * kwds.get('repeat', 1)
result = [[]]
for pool in pools:
result = [x+[y] for x in result for y in pool]
for prod in result:
yield tuple(prod)
,後來在節目:
list(set((product(*[range(2) for _ in range(length)]))))
是的,完全是爲了計算排列。畢竟這是一個非圖解求解器。 – petajamaja 2013-03-23 16:51:47