title: python for loop list plus one item
body: <p>I'm handling mouse clicks on objects based on the location of the object on the screen. I record the xy coord of the mouse click and see if it matches any of the objects that are allowed to be clicked on. The objects are in different lists or just single objects, but I want them in one big list so I can just loop through the whole thing once, if the click is on one of the objects, do the work, break. You can only click on one object.</p>
  
  <p>First method: how i'm doing it now:</p>
  
  <pre><code>list = [obj1, obj2, obj3]
  singleobj
  
  copylist = list
  copylist.append(singleobj)
  
  for item in copylist:
      if item.pos == mouseclick.pos:
          doWork(item)
          break
  </code></pre>
  
  <p>Second method: I'd rather do something like below, but obviously the <code>list+singleobj</code> is not valid:</p>
  
  <pre><code>for item in list+singleobj:
      if item.pos == mouseclick.pos:
          doWork(item)
          break
  </code></pre>
  
  <p>Third method: Or if I absolutely had to, I could do this horrible terrible code:</p>
  
  <pre><code>list = [obj1, obj2, obj3]
  
  foundobj = None
  
  for item in list:
      if item.pos == mouseclick.pos:
          foundobj = item
          break
  
  if foundobj is None:
      if singleobj.pos == mouseclick.pos:
          foundobj = singleobj
  
  #possibly repeated several times here....
  
  
  if foundobj is not None:
      doWork(foundobj)
  </code></pre>
  
  <p>The first method seems slow because I have to copy all of the (possibly many) lists and single objects into one list.</p>
  
  <p>The second method seems ideal because it's compact and easy to maintain. Although, as it stands now it's simply pseudo code.</p>
  
  <p>The third method is bulky and clunky.</p>
  
  <p>Which method should I use? If the second, can you give the actual code?</p>