title: dynamic properties with decorators
body: <p>I would like to create a series of object properties using a loop. Specifically, i want to generate 'secondary' properties by applying a list of functions to existing properties.
  my attempt is shown in  a function called <code>gen_secondary_properties</code>, shown below. The problem is that all of the properties are equal to one another, and i am not sure why. </p>
  
  <pre><code>def gen_secondary_properties(sefl):
      prop_dict = {
          's' : self.s,
          'y' : self.y,
          'z' : self.z,
          }
      func_dict = {
          'real': npy.real,
          'imag': npy.imag,
          }
      for prop_key in prop_dict:
          for func_key in func_dict:
              fget = lambda self: func_dict[func_key](prop_dict[prop_key])
              setattr(self.__class__,'%s_%s'%(prop_key, func_key),\
                  property(fget))
  </code></pre>
  
  <p>what DOES work is a function which creates a single property at a time, and then call this function from the loop. </p>
  
  <pre><code>def __add_secondary_property(self, func , prop_name):
      fget = lambda self: func(self.__getattribute__(prop_name))
      setattr(self.__class__,'%s_%s'%(prop_name,func.__name__),\
          property(fget))
  
  
  for prop_name in ['s','z']:
      for func in [npy.real, npy.imag]:
          self.__add_secondary_property(func, prop_name)
  </code></pre>