Iterating over multiple indices with i > j ( > k) in a pythonic way
问题 i need to iterate over a tuple of indices. all indices must be in the range [0, N) with the condition i > j . The toy example I present here deals with only two indices; I will need to extend that to three (with i > j > k ) or more. The basic version is this: N = 5 for i in range(N): for j in range(i): print(i, j) and it works just fine; the output is 1 0 2 0 2 1 3 0 3 1 3 2 4 0 4 1 4 2 4 3 I don't want to have one more indentation level for every additional index, therefore I prefer this