title: Python default value in constractor is ignored?
body: <p>I'm new to python. When I code in Python I notice this strange behavior:</p>
  
  <p>Class x:</p>
  
  <pre><code>class x:
      x1 = 0
  
      def __init__(self, x):
          self.x1 = x
  </code></pre>
  
  <p>Class xcontainer:</p>
  
  <pre><code>class xContainer:
      coint = []
  
      def __init__(self, coint = []):
          self.coint = coint
  
      def add_x(self, x):
          self.coint.append(x)
  </code></pre>
  
  <p>when I try to run this code:</p>
  
  <pre><code>def Main():
      list_xcon = []
      for i in range (0,2):
          xcon = xContainer()
          for j in range (i, i+1):
              xcon.add_x(x(j))
          list_xcon.append(xcon)
  
      for xcont in list_xcon:
          for xc in xcont.coint:
              print xc.x1
  </code></pre>
  
  <p>I get those results:</p>
  
  <blockquote>
    <p>0 1 0 1</p>
  </blockquote>
  
  <p>but when I run this code:</p>
  
  <pre><code>def Main():
      list_xcon = []
      for i in range (0,2):
          listt = []
          xcon = xContainer(listt)
          for j in range (i, i+1):
              xcon.add_x(x(j))
          list_xcon.append(xcon)
  
      for xcont in list_xcon:
          for xc in xcont.coint:
              print xc.x1
  </code></pre>
  
  <p>I get those results:</p>
  
  <blockquote>
    <p>0 1</p>
  </blockquote>
  
  <p>Why is that? According to <code>class xcontainer</code>, the default of <code>coint</code> should be <code>[]</code> - empty list. So why sending empty list change the result?</p>
  
  <p>By the way, I read that using <code>coint = None</code> as default and checking <code>if coint is None: coint = []</code> is better way, but it seems that it does not change the results here.</p>
  
  <p>I will appreciate any explanation. I'm confused.</p>
  
  <p>Thanks.</p>