title: Writing big python classes the right way
body: <p>When writing a python class that have different functions for getting the data, and parsing the data; what is the most correct way?
  You can write it so you are populating self.data... one by one, and then running parse functions to populate self.parsed_data.... Or is it correct to write functions that accept self.data and returns self.parsed_data..?</p>
  
  <p>Examples below.
  MyClass1 populates self.variables, and MyClass2 takes them as parameters.
  I think MyClass2 is "most" correct.</p>
  
  <p>So, what is correct? And why? I have been trying to decide upon which of these two coding styles for a while. But I want to know which of these are considered best practice.</p>
  
  <pre class="lang-python prettyprint-override"><code>class MyClass1(object):
      def __init__(self):
          self.raw_data = None
  
      def _parse_data(self):
          # This is a fairly complex function xml/json parser
          raw_data = self.raw_data
          data = raw_data  #  Much for is done to do something with raw_data
          cache.set('cache_key', data, 600)  # Cache for 10 minutes
          return data
  
      def _populate_data(self):
          # This function grabs data from an external source
          self.raw_data = 'some raw data, xml, json or alike..'
  
      def get_parsed_data(self):
          cached_data = cache.get('cache_key')
          if cached_data:
              return cached_data
          else:
              self._populate_data()
              return self._parse_data()
  
  mc1 = MyClass1()
  print mc1.get_parsed_data()
  
  
  class MyClass2(object):
      def _parse_data(self, raw_data):
          # This is a fairly complex function xml/json parser
          data = raw_data  # After some complicated work of parsing raw_data
          cache.set('cache_key', data, 600)  # Cache for 10 minutes
          return data
  
      def _get_data(self):
          # This function grabs data from an external source
          return 'some raw data, xml, json or alike..'
  
      def get_parsed_data(self):
          cached_data = cache.get('cache_key')
          if cached_data:
              return cached_data
          else:
              return self._populate_data(self._get_data())
  
  mc2 = MyClass2()
  print mc1.get_parsed_data()
  </code></pre>