title: List comprehension with *args
body: <p>I would like to write a function to return a set of strings using python´s list comprehension if any of the passed arguments is in the list. However, it throws <em>requires string as left operand, not tuple</em>, and when trying with another for loop it throws <em>local variable j referenced before assignment</em></p>
  
  <pre><code>def checkFor(*args):
      return {a['title'] for a in soup.findAll('a') if 'title' in a.attrs and any(args in a['title'])}
  
  def checkFor_(*args):
      return{a['href'] for a in soup.findAll('a') if 'title' in a.attrs and j in a['title'] for i, j in enumerate(args)}
  
  checkFor(a, b, c)
  </code></pre>
  
  <p>Ï could surely do it with for loops but I am trying to use list comprehension. Any hints? Thanks.</p>