title: Python OOP and lists
body: <p>I'm new to Python and it's OOP stuff and can't get it to work. Here's my code:</p>
  
  <pre><code>class Tree:
  
      root = None;
      data = [];
  
      def __init__(self, equation):
          self.root = equation;
  
      def appendLeft(self, data):
          self.data.insert(0, data);
  
      def appendRight(self, data):
          self.data.append(data);
  
      def calculateLeft(self):
          result = [];
          for item in (self.getLeft()):
              if (type(item) == type(self)):
                  data = item.calculateLeft();
              else:
                  data = item;
              result.append(item);
          return result;
  
      def getLeft(self):
          return self.data;
  
      def getRight(self):
          data = self.data;
          data.reverse();
          return data;
  
  tree2 = Tree("*");
  tree2.appendRight(44);
  tree2.appendLeft(20);
  
  tree = Tree("+");
  tree.appendRight(4);
  tree.appendLeft(10);
  tree.appendLeft(tree2);
  
  print(tree.calculateLeft());
  </code></pre>
  
  <p>It looks like tree2 and tree are sharing list "data"?</p>
  
  <p>At the moment I'd like it to output something like [[20,44], 10, 4], but when I</p>
  
  <pre><code>tree.appendLeft(tree2) 
  </code></pre>
  
  <p>I get <code>RuntimeError: maximum recursion depth exceeded</code>, and when i even won't <code>appendLeft(tree2)</code> it outputs <code>[10, 20, 44, 4]</code> (!!!). What am I missing here? I'm using Portable Python 3.0.1.</p>
  
  <p>Thank you</p>