title: TypeError: 'collections.defaultdict' object is not callable
body: <p>I having this error when I tried to print objects in my index.. what I am trying to do is to search lname and print its object values...</p>
  
  <pre><code>from collections import defaultdict
  class Pbook(object):
      lname_index = defaultdict(list)
  
      def __init__(self, lname, fname, age):
          self.lname=lname
          self.fname=fname
          self.age=age
          Pbook.lname_index[lname].append(self)
  
      def __str__(self):
          return "%s %s %s" % (self.lname, self.fname, self.age)
  
  
  
  myList = []
  myList.append(Pbook("john","smith",23))
  myList.append(Pbook("george","bush",25))
  
  print Pbook.lname_index
  </code></pre>
  
  <blockquote>
    <p>defaultdict(, {'bush': [&lt;<strong>main</strong>.Pbook object at
    0x000000000585EC50>], 'smith': [&lt;<strong>main</strong>.Pbook object at
    0x000000000585EC88>]})</p>
  </blockquote>
  
  <pre><code>if "bush" in Pbook.lname_index:
      print "found"
  </code></pre>
  
  <p>found      </p>
  
  <pre><code>if "bush" in Pbook.lname_index:
      print Pbook.lname_index(myList)
  </code></pre>
  
  <blockquote>
    <p>TypeError: 'collections.defaultdict' object is not callable</p>
  </blockquote>