title: Custom constructors for models in Google App Engine (python)
body: <p>I'm getting back to programming for Google App Engine and I've found, in old, unused code, instances in which I wrote constructors for models.  It seems like a good idea, but there's no mention of it online and I can't test to see if it works.  Here's a contrived example, with no error-checking, etc.:</p>
  
  <pre><code>class Dog(db.Model):
      name = db.StringProperty(required=True)
      breeds = db.StringListProperty()
      age = db.IntegerProperty(default=0)
  
      def __init__(self, name, breed_list, **kwargs):
          db.Model.__init__(**kwargs)
          self.name = name
          self.breeds = breed_list.split()
  
  rufus = Dog('Rufus', 'spaniel terrier labrador')
  rufus.put()
  </code></pre>
  
  <p>The **kwargs are passed on to the <a href="http://code.google.com/appengine/docs/python/datastore/modelclass.html" rel="nofollow noreferrer">Model</a> constructor in case the model is constructed with a specified <code>parent</code> or <code>key_name</code>, or in case other properties (like <code>age</code>) are specified.  This constructor differs from the default in that it <em>requires</em> that a <code>name</code> and <code>breed_list</code> be specified (although it can't ensure that they're strings), and it parses <code>breed_list</code> in a way that the default constructor could not.</p>
  
  <p>Is this a legitimate form of instantiation, or should I just use functions or static/class methods?  And if it works, why aren't custom constructors used more often?</p>