title: Subclassing namedtuple with properties
body: <p>I have some classes that have properties already defined and I am now looking for a way to pack data into a named tuple to interact with a database. I would like to have some of the properties (but not all) into the named tuple so that I can assign field names when retrieving data from the database. </p>
  
  <pre><code>from collections import namedtuple
  import sqlite3
  
  Foo = namedtuple('Foo', 'a, b')
  
  class FooChild(Foo):
  
      def do_some_calculation(self):
          self.d = 2
          return self.d
  
      @property
      def b(self):
          return (self.a,)*2 + (self.d,)
  
      @property
      def c(self):
           return 'bar'
  
  def retrieve_data():
      conn = sqlite3.connect('/foodata')
      cursor = conn.cursor()
      cursor.execute('SELECT a, b FROM foos')
      for foo in map(Foo._make, cursor.fetchall()):
          print(foo.a, foo.b)
  
  
  foo = Foo(11, ())
  print(foo.a, foo.b, foo._asdict())
  </code></pre>
  
  <p>but <code>print(foo._asdict())</code> returns <code>OrderedDict([('a', 11), ('b', ())])</code> since the named tuple is immutable.</p>
  
  <p>The 'b' property cannot be calculated during instantiation of the <code>namedtuple</code>.</p>
  
  <p>Can somebody advise on the way to go in this situation ? </p>