title: getters/setters for a python class that inherits dict
body: <p>To aid in serializing to JSON, I commonly build a class that inherits from the python dict class.  If the class is supposed to have specific fields, I want there to be methods to get &amp; set.</p>
  
  <p>Currently, I construct a class like:</p>
  
  <pre><code>class MyRequest(dict):
      def __init__(self, firstName=None, lastName=None):
          self['firstName'] = firstName
          self['lastName'] = lastName
  
      def get_firstName(self):
          return self['firstName']
      def set_firstName(self, firstName):
          self['firstName'] = firstName
  
      def get_lastName(self):
          return self['lastName']
      def set_lastName(self, lastName):
          self['lastName'] = lastName
  </code></pre>
  
  <p>But this is really cumbersome to work with.  Since the underlying 'storage' is a dictionary, I can't just access fields like</p>
  
  <pre><code>myReq.firstName = "Foo"
  print myReq.lastName
  </code></pre>
  
  <p>But is there a way to get to there while still keeping the dict backing?</p>