# listing all those pairs of tuples which are permutations of each other

Suppose I have a list of tuples like

```
import itertools
l=range(0,6)
m=itertools.combinations(l,2)
list(m)
```

How do I get those pairs of tuples `(i,j);(x,y)`

such that `(i,j)=(y,x)`

? Also, is there a way to generalize this, that is, I would to have pairs of tuples `(a,b,c,...);(x,y,z...)`

such that `(a,b,c...)=(z,y,x...)`

. Is there any efficent way of doing this? Thanks beforehand.

I guess

`itertools.combinations(1,2)`

should be replaced by`itertools.combinations(l,2)`

.(I edited, changing

`1`

to`l`

.)Please

neveruse a single ell-letter for the name of a variable, even if it stays for a list. (In our case it is a range...)@dan_fulea: next you're probably going to suggest that we shouldn't use "O" for a variable, either...