title: Python: None type object is not callable
body: <p>I'm doing a game in pygame and what I'm trying to do, is to make an entity target another. 
  When I call the target function, I get "TypeError: NoneType object is not callable" What I understood after doing research on this error, is that it occurs, when you try to use the return value of a function that hasn't any.
  But, my function isn't supposed to return something and I don't use a return value, so I'm a bit out of ideas.
  I hope someone can help me, here is my code:
  target function</p>
  
  <pre><code>def target(self,x,y):
      target = self.world.getPointEntity(x,y)  
      if target != None and target.get_itarget():
          self.set_target(target)
  </code></pre>
  
  <p>call to target function</p>
  
  <pre><code>self.player.target(x,y)
  </code></pre>
  
  <p>If you have any questions, feel free to ask.</p>
  
  <p>EDIT: Code of getPointEntity function:</p>
  
  <pre><code>    def getPointEntity(self, x, y, searchRange=24):
          for entity in self.entities.itervalues():
              if entity != None:
                  distance = entity.get_distance(x, y)
                  if distance &lt; searchRange:
                      return entity
          return None   
  </code></pre>
  
  <p>As for the get_itarget function, it just returns True or False depending on the respective entity being a legal target or not.
  The traceback points to line with self.player.target()
  Full traceback:</p>
  
  <pre><code>__Main2.py", line 971, in &lt;module&gt;
  Game(1920,1080)    
  __Main2.py", line 795, in __init__
  self.run()
  __Main2.py", line 910, in run
  self.player.target(x,y)
  TypeError: 'NoneType' object is not callable
  </code></pre>
  
  <p>EDIT: the method target belongs to the super class of the player class.</p>
  
  <pre><code>class Player(LivingEntity):
      def __init__(self, name, world, image, x, y, speedModifier, sizeradius, inv_image, filler, shadow, scx, scy, animseq, animn):
          LivingEntity.__init__(self, name, world, image, x, y, speedModifier, sizeradius, animseq, animn)
          self.inventory = None
          self.scx = scx
          self.scy = scy
          self.addInventory(inv_image, filler, shadow)
  
  class LivingEntity(GameEntity):
      def __init__(self, name, world, images, x, y, speedModifier, sizeradius, animseq, animn, xshift=48, yshift=48):
          GameEntity.__init__(self, name, world, images, x, y, speedModifier, sizeradius, animseq, animn, xshift, yshift)
          self.target = None
  
      def set_target(self, target):
          self.target = target
  
      def target(self,x,y):
          target = self.world.getPointEntity(x,y)  
          if target != None and target.get_itarget():
              self.set_target(target)
  </code></pre>
  
  <p>I kind of solved the problem by putting the check for a target entity outside of the target function. I can't really see the differnce but it seems to work.            </p>