I need to generate all points coordinates by given dimensions, for example:
>>>points(2,2)
>>>[(0,0),(0,1),(1,0),(1,1)]
>>>points(1,1,1)
>>>[(0,0,0),(0,0,1),(0,1,0),(0,1,1),(1,1,0),(1,1,1)]
I,ve seen solution for 2-dimensions, but cant find a way to make method independent of number of dimensions:
>>> from itertools import product
>>> list(product(xrange(d) for d in (1,2,3)))
[(xrange(1),), (xrange(2),), (xrange(3),)] #where is my tuples?
where (1,2,3) are *args tuple, which can be anything.