I need to define __setattr__ for assignment of fields without properties, but use the setter/getter functions for fields with a property defined
<p>Defining <code>__setattr__</code> overrides all setter methods / properties I define in a class.  I want to use the defined setter methods in the property, if a property exists for a field and use  <code>self.__dict__[name] = value</code> otherwise.</p>

<p>Help!  I found one solution that used <code>__setitem__</code>, but this does not work for me</p>

<p>Where are properties stored in a python class?  How do I access them?</p>

<p>How do I define <code>__setattr__</code> so that it uses the properties for fields with setter methods defined?</p>

<pre><code>class test(object):

def _get_gx(self):
    print "get!"
    return self.__dict__['gx']

def _set_gx(self, gx):
    print "set!"
    self.__dict__['gx'] = gx
    gx = property(_get_gx, _set_gx)

def __setattr__(self, name, value):
    self.__dict__[name] = value

def __init__(self):
    pass
</code></pre>

<p>also,</p>

<p>Why is "get!" printed twice when I do,</p>

<pre><code>x = test()
x.gx = 4
x.gx

prints: 

   "gets!"
   "gets!"
   4
</code></pre>
