generates all tuples (x, y) in a range
Question: I'd like to know what is the pythonic way to generate all tuples (x, y) where
x and y are integers in a certain range. I need it to generate n points and I
don't want to take the same point two or more times.


Answer: The most Pythonic way is to use the standard library:

    
    
    >>> import itertools
    >>> itertools.product(range(3), range(4))
    <itertools.product object at 0x7f2b5c8bc510>
    >>> list(_)
    [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1),
     (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)]
    

