KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Using Python, I'd like to compare every possible pair in a list. Suppose I have my_list = [1,2,3,4] I'd like to do an operation (let's call it foo) on every combination of 2 elements from the list. The final result should be the same as foo(1,1) foo(1,2) ... foo(4,3) foo(4,4) My first thought was to iterate twice through the list manually, but that doesn't seem very pythonic.
Tags (comma-separated)
Save Edits
Cancel