title: How to access an object in a list by property?
body: <p>Consider a list of objects and a method that works on one object:</p>
  
  <pre><code>beers = []
  beers.append(Beer('Carlsberg', 'tasty'))
  beers.append(Beer('Guinness', 'bitter'))
  beers.append(Beer('Leffe', 'perfect'))
  
  def howIsBeer (name):
      taste = ???
      print taste
  
  Class Beer:
      def __init__ (self, name, taste):
          self.name = name
          self.taste = taste
  </code></pre>
  
  <p>How would the <code>howIsBeer()</code> method go about getting the taste of a beer if it is provided only with the beer name? <strong>My first inclination is to iterate the <code>beers</code> list, but being Python I suspect that there is a more direct method. Is there?</strong></p>