title: Pythonic Way to Initialize (Complex) Static Data Members
body: <p>I have a class with a complex data member that I want to keep "static". I want to initialize it once, using a function. How Pythonic is something like this:</p>
  
  <pre><code>def generate_data():
      ... do some analysis and return complex object e.g. list ...
  
  class Coo:
      data_member = generate_data()
      ... rest of class code ...
  </code></pre>
  
  <p>The function <code>generate_data</code> takes a long while to complete and returns data that remains constant in the scope of a running program. I don't want it to run every time class Coo is instantiated.</p>
  
  <p>Also, to verify, as long as I don't assign anything to <code>data_member</code> in <code>__init__</code>, it will remain "static"? What if a method in Coo appends some value to <code>data_member</code> (assuming it's a list) - will this addition be available to the rest of the instances?</p>
  
  <p>Thanks</p>