On 2010-06-30 08:53, Daniel Shahaf wrote:
> ne...@apache.org wrote on Tue, 29 Jun 2010 at 23:22 -0000:
>> +  p = Permutations(('A', 'B'), (1, 2, 3), ('-',), (x, y))
>> +  print "All items:"
>> +  while p.next():
>> +    print p.row
> 
> Does this duplicate the functionality of itertools.product()?
> 
> http://docs.python.org/library/itertools.html?highlight=cartesian

indeed. I asked #python cause it's a bit hard to understand the itertools
help page. And it seems product() does exactly what I want.

list( itertools.product( (1,2), (a,b,c), (x,y) ) )

thanks!
~Neels

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to