Combining elements of list
<p><strong>Question</strong>: 
Given a set of numbers <code>S_a={n1,n2,n3,...,na}</code> produce the following combination of numbers of the type:</p>

<pre><code>{Sk,Sp}, where k=1...a, p=k+1,..,a
</code></pre>

<p>One can easily construct this solution as a loop:</p>

<pre><code>N = len(S)
for i in range(0, N):
    for j in range(i+1, N):
                 print("%d,%d" %(i,j))
</code></pre>

<p>But I am looking for a vectorized solution.</p>

<hr>

<p>Another variation of this is to consider a list of objects:</p>

<pre><code>class A:
    def function(self, a):
        pass
L = [a1, a2, a3, a4, a5 ]

#where a1,a2,an are of class A.
</code></pre>

<p>how to write the a vectorized version of this loop:</p>

<pre><code>N = len(L)-1
for i in range(0, N):
    for j in range(i+1, N):
        L[i].function(L[j])
</code></pre>
