title: How can I overload the assignment of a class member?
body: <p>I am writing a Player model class in Python with Django, and I've ran into a small problem with the password member. I'd like the password to be automatically hashed upon assignment, but I can't find anything about overloading the assignment operator or anything.  Is there any way I can overload the assignment of <code>password</code> so as to automatically do <code>hashlib.md5(password).hexdigest()</code> on it?</p>
  
  <pre><code>from django.db import models
  
  class Player(models.Model):
      name = models.CharField(max_length=30,unique=True)
      password = models.CharField(max_length=32)
      email = models.EmailField()
  </code></pre>