python class setter restrictions
<p>I have a class and a property <code>writable_attributes</code> which is an array of attributes that should be available to bet set when the class is instantiated:</p>

<pre><code>class User(object):
    writable_attributes = ['username','email']
</code></pre>

<p>I want to be able to raise an error if another attribute is set if it's not in the list of <code>writable_attributes</code>. I was browsing for a generic setter but I can't find anything to fit my needs. Something like:</p>

<pre><code>user = User()
user.foo = 'bar' # This should raise an error since only `username` and `email` can be set
</code></pre>
