title: making a class callable in same instance
body: <pre><code>class Foo(object):
      def tick(self):
          print("something")
  
  class Bar(object):
      def __init__(self):
          self.foo = Foo()
  
      def tick(self):
          #Here's what I do....
          self.foo.tick()
  
          #here's what my goal would be
          self.foo()
  
  b = Bar()
  b.tick()
  </code></pre>
  
  <p>That's essentially my goal. From what I've gathered I could change the tick function to <code>__call__</code> and that would allow me to do what I wanted. A couple of the other answers said that this would make a new instance of the object, does that mean that it would use self.foo's memory? or would it make a whole new object, newly instanced? or make a copy of self.foo?</p>
  
  <p>Also a couple of drawbacks to this which may or may not manifest themselves come to mind. For a particular part of my program, I check to see if the object has a <code>__call__</code> to determine if the argument I'm passing is a function or a variable, and I don't really think I would want to allow that to be called (even though, I suppose the class technically would be a function at that point.) Is there any way to distinguish between a function and a callable class?</p>
  
  <p>Is there anything else that would make doing this undesirable (and is it a pythonic way to work?)? My next thought had been that given that other variable prefixed with <code>__</code> cant be used outside their class, but that doesnt seem to be the case here.</p>