title: Python TypeError: descriptor 'append' for 'list' objects doesn't apply to a 'int' object
body: <p>I am trying to solve a LeetCode problem in python. Given a list of integers and a target, we must find all the unique combination of integers in the list whose sum is equal to the target. The list can have duplicate integers but the combinations of the integers (whose sum is equal to the target) must be unique in the result. The list will have only positive integers <a href="https://leetcode.com/problems/combination-sum-ii/" rel="nofollow noreferrer">https://leetcode.com/problems/combination-sum-ii/</a></p>
  
  <p>Below is the code:</p>
  
  <pre><code>class Solution:
      def combinationSum2(self, candidates: List[int], target: int) -&gt; List[List[int]]:
          result = List[List[int]]
          c = List[int]
          self.combSum2(0,sorted(candidates),target,result,c)
          return result
  
      def combSum2(self, i: int, l: List[int], t: int, res: List[List[int]], curr: List[int]):
          if t == 0:
              print(curr)
              res.append(curr)
              return
          if t &lt; 0:
              return
          for idx in range(i,len(l):
              if(idx == i or l[idx] != l[idx-1]):
                  curr.append(l[idx])
                  self.combSum2(idx+1,l,t-l[idx],res,curr)
                  del curr[-1] 
  </code></pre>
  
  <p>The code does produce unique combinations, however, when I run it I am getting this error: 
  <code>TypeError: descriptor 'append' for 'list' objects doesn't apply to a 'int' object</code> at the line <code>curr.append(l[idx])</code>. <a href="https://i.stack.imgur.com/ooF3g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ooF3g.png" alt="enter image description here"></a></p>
  
  <p>How to resolve this? Any help would be appreciated.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I have tried what @user2357112 supports Monica suggested and changed my code:</p>
  
  <pre><code>class Solution:
      def combinationSum2(self, candidates: List[int], target: int) -&gt; List[List[int]]:
          result = []
          c = []
          self.combSum2(0,sorted(candidates),target,result,c)
          print("result:")
          print(result)
          return result
  
      def combSum2(self, i: int, l: List[int], t: int, res: [], curr: []):
          if t == 0:
              print(curr)
              res.append(curr)
              return
          if t &lt; 0:
              return
          for idx in range(i,len(l)):
              if(idx == i or l[idx] != l[idx-1]):
                  curr.append(l[idx])
                  self.combSum2(idx+1,l,t-l[idx],res,curr)
                  del curr[-1]
  </code></pre>
  
  <p>Now the error is gone but the result is empty:</p>
  
  <pre><code>[1, 1, 6]
  [1, 2, 5]
  [1, 7]
  [2, 6]
  result:
  [[], [], [], []]
  </code></pre>
  
  <p>The combinations are being created, but not getting appended to the result.</p>
  
  <p>I can't figure out where the bug is. Any help would be appreciated. Thank you.</p>