title: python "nonetype" object error, but it seems not none value
body: <pre><code>def triangle(n):
      if n == 0:
          return []
      if n == 1:
          return [[1]]
      else:
          before = triangle(n - 1)
          calculate = [0] + before[-1] + [0]
          now = []
          i = 0
          while i &lt; len(calculate) - 1:
              now.append(calculate[i] + calculate[i + 1])
              i = i + 1
          print now
          return before.append(now)
  
  
  #Expected output:
  
  print triangle(0)
  #&gt;&gt;&gt; []
  
  print triangle(1)
  #&gt;&gt;&gt; [[1]]
  
  print triangle(2)
  #&gt;&gt; [[1], [1, 1]]
  
  print triangle(3)
  #&gt;&gt;&gt; [[1], [1, 1], [1, 2, 1]]
  
  print triangle(6)
  #&gt;&gt;&gt; [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], [1, 5, 10, 10, 5, 1]]
  </code></pre>
  
  <p>in this code, when the input value is 2, returned None. if the input velue is more then 2, the code referenced triangle(2), and Nonetype object error occurred</p>
  
  <p><a href="https://stackoverflow.com/questions/21095654/what-is-a-nonetype-object">with a little googleing</a>, I know the this error is because of None value.</p>
  
  <pre><code>&gt;&gt;&gt; bar = "something"
  &gt;&gt;&gt; foo = None
  &gt;&gt;&gt; print foo + bar
  TypeError: cannot concatenate 'str' and 'NoneType' objects
  </code></pre>
  
  <p>but i think the code not concatenate None velue.</p>
  
  <pre><code>return before.append(now)
  </code></pre>
  
  <p>this code concatenate before and now.
  so i wrote debug code like this.</p>
  
  <pre><code>        print "before is"
          print before
          print "now is"
          print now
          return before.append(now)
  </code></pre>
  
  <p>the result is</p>
  
  <pre><code>triangle(2)
  
  before is
  [[1]]
  now is
  [1, 1]
  None
  </code></pre>
  
  <p>before and now, both are not None!</p>
  
  <p>I already re-write the code several times, but all code has error. Pleace help me! i using python 2.</p>
  
  <p>it is first time to using stackoverflow, so pleace notice me if i contrary to regulations</p>