title: Lateral association between an object and a function assigned to variable
body: <p>I have objects defined that are evolving under a subroutine, and under subsubroutines. And I want to probe the status of these variables via probes.</p>
  
  <p>For example, lets call this class drunk.</p>
  
  <pre><code>class drunk (object):
      def __init__(self):
          self.position = 0
          self.probability = 0.5
      def take_a_step():
          # code that will make the drunkard change its position
  </code></pre>
  
  <p>Then, I may generate many drunkards and put them into a class crowd.</p>
  
  <pre><code>class crowd (object):
      def __init__(self):
          self.inidividuals = num.array([])
  </code></pre>
  
  <p>I would like to create a "probe" object that can be assigned into any of those objects, but I have implementation problems. </p>
  
  <pre><code>class probe (object):
      def __init__(self):
          self.function = None
          self.data = num.array([])
  </code></pre>
  
  <p>I want to assign probes to any drunkard, a probe will extract <strong>any</strong> information from a crowd, or a drunk, that is defined in a function residing in probe.function.</p>
  
  <p>But as far as I am concerned, I can assign probes by putting them into a list within these classes, and call them by relating to the functions within the methods of the classes crowd and drunk.</p>
  
  <p>But in order to do this,</p>
  
  <pre><code>probe_mean = probe()
  def probe_function():
      #
      #
      #
  probe_mean.function = probe_function()
  </code></pre>
  
  <p>But since I want to refer to a variable within a class that the function will be within the list of, It seems that I must define the function as</p>
  
  <p>But in order to do this,</p>
  
  <pre><code>probe_mean = probe()
  def probe_function(probed):
      return probed.position.mean()
  probe_mean.function = probe_function(drunk_53)
  
  drunk_53.probes.append(probe_mean)
  </code></pre>
  
  <p>I have a feeling from the fact that these to objects should refer to each other in order for this to work, this is not he way it should be. </p>
  
  <p>I thought that there must be a way to deal with this without re-introducing drunk_53 to the function, something like a super(), that will enable a vertical association.</p>
  
  <p>I'm not experienced in OOP, so I'm asking for the most suitable way (Pythonic, elegant etc.) to do this. What are your opinions? What approach would you take?</p>