title: Confusing about passing list in recursion function of python
body: <pre><code>class Solution(object):
  def combinationSum2(self, candidates, target):
      """
      :type candidates: List[int]
      :type target: int
      :rtype: List[List[int]]
      """
      candidates.sort()
      res = []  # save the result
      path = []  # save each unique combination
      self.dfs(0, target, path, res, candidates)
      return res
  
  def dfs(self, start_index, target, path, res, candidates):
      if target == 0:
          res.append(path)
          return
      if target &lt; 0:
          path.pop()
          return
      for i in range(start_index, len(candidates)):
          if i &gt; start_index and candidates[i] == candidates[i-1]:
              continue
          path += [candidates[i]]
          self.dfs(i+1, target-candidates[i], path, res, candidates)
          if path:
              path.pop()
  </code></pre>
  
  <p>The above code for LeetCode problem <em>Combination Sum II</em>, given the input <code>[10,1,2,7,6,1,5]</code> and <code>8</code>, the output should be <code>[[1,1,6],[1,2,5],[1,7],[2,6]]</code>. However, the output of this piece of code run to be <code>[[],[],[],[]]</code>, I'm very confusing and wondering why :(</p>