title: Cant Solve "inc() takes 1 positional argument but 2 were given"
body: <p>I am trying to develop a list(lets called "l") of list of tuple of two natural numbers(excluding 0) such as "a" can be a memeber of "l" if len(a) == len and for every member(lets call p) of "a", p[0] &lt;= max and p[1] &lt;= max</p>
  
  <p>For example poslist_all(max=2,len=1)</p>
  
  <pre><code>[[(1,1)],[(1,2)],[(2,1)],[(2,2)]]
  </code></pre>
  
  <p>and poslist_all(2,2)</p>
  
  <pre><code>[[(1,1),(1,1)],[(1,1),(1,2)],[(1,1),(2,1)],[(1,1),(2,2)],...,[(2,2),(1,1)],[(2,2),(1,2)],[(2,2),(2,1)],[(2,2),(2,2)]]
  </code></pre>
  
  <p>So I am trying to make that list an iterator and came up with this code,</p>
  
  <pre><code>class poslist_all:
      def __init__(self,max,len):
          self.max = max
          self.len = len
          self.iposlist = len*[(1,1)]
      def __iter__(self):
          return self
      def __next__(self):
          ml = self.maxlist()
          if ml:
              if ml[0] == 0:
                  raise StopIteration
              else:
                  toinc = ml[0]-1
                  self.inc(ml[0] - 1)
                  for i in range(ml[0],self.len-1):
                      self.iposlist[i] = (1,1)
                  return self.iposlist
          else:
              self.inc(self.len - 1)
              return self.iposlist
      def maxlist(self):
          return [x for x,y in enumerate(self.iposlist) if y == (self.max,self.max)]
      def inc(pnum):
          if self.iposlist[pnum][1] == self.max:
              return (self.iposlist[pnum][0]+1,1)
          else:
              return (self.iposlist[pnum][0],self.iposlist[pnum][1]+1)
  
  if __name__ == "__main__":
      for ps in poslist_all(2,2):
          print(ps)
  </code></pre>
  
  <p>but this always returns</p>
  
  <pre><code>Traceback (most recent call last):
    File "./helper.py", line 33, in &lt;module&gt;
      for ps in poslist_all(2,2):
    File "./helper.py", line 22, in __next__
      self.inc(self.len - 1)
  TypeError: inc() takes 1 positional argument but 2 were given
  </code></pre>
  
  <p>Whats causing this error ? How to solve it ?
  Is there more pythonic way to do this ?</p>