title: Django optimize for loop in method
body: <p>I wrote the method to check one attribute and return False if there is an artist with selling=False, and True otherwise.</p>
  
  <pre><code>def check_selling(track, excludes):
      """
      Returns True if all track's artists are allowed for selling. False otherwise
      """
      for artist in track.artists.all():
              if not artist.selling:
                  excludes.append(track.pk)
                  return False
      return True
  </code></pre>
  
  <p>How can i minimize this?</p>
  
  <p>I tried:</p>
  
  <pre><code>def check_selling(track, excludes):
      res = excludes.append(track.pk) if not [artist.selling for artist in track.artists.all()] else True
      return res or False
  </code></pre>
  
  <p>But [False] or [True] resulting in list comprehension [artist.selling for artist in track.artists.all()] always gives True...</p>