title: How to adapt Python loop generation to be conditional?
body: <p>I have some Python code like this:</p>
  
  <pre><code>print seq(y), '\t', ', '.join(['%s-%s'%i for i in holetbl[y]])
  </code></pre>
  
  <p>But I would like to make the inner string generation conditional.  The <code>i</code> in the loop is a tuple of two values which get put into the two <code>%s</code> values in the string.  In the case that the tuple values are the same, I would instead only like one value as in:</p>
  
  <pre><code>print seq(y), '\t', ', '.join(['%s'%i for i, j in holetbl[y]])
  </code></pre>
  
  <p>How can I make a condition to test if <code>i == j</code> and if so to only print the <code>i</code> value, otherwise, both the <code>i</code> and <code>j</code> values as in the original above?</p>