Operation on every pair of element in a list
<p>Using Python, I'd like to compare every possible pair in a list.</p>

<p>Suppose I have</p>

<pre><code>my_list = [1,2,3,4]
</code></pre>

<p>I'd like to do an operation (let's call it foo) on every combination of 2 elements from the list.</p>

<p>The final result should be the same as</p>

<pre><code>foo(1,1)
foo(1,2)
...
foo(4,3)
foo(4,4)
</code></pre>

<p>My first thought was to iterate twice through the list manually, but that doesn't seem very pythonic.</p>
