title: How to recursively get diagonals given the row and column of an element in a 2D list of any dimensions?
body: <p>I want to write a recursive function that gets the diagonals to a cell element given the cell's row and column indexes. My algorithm so far only progresses to get the diagonal going to the bottom right of the 2D list, but I'd like it to get all the diagonals for any cell position. <code>rs cs</code> are the row and column indexes of the cell we want to get the diagonals for and <code>r c</code> are the current cell's indexes.</p>
  <p>I have the general idea, but I can't get the specifics down. It's been a while since I've delved into recursion and I could use some help.</p>
  <pre><code>#self is an instance of Board
  def getDiag(self,rs,cs,r,s,lst=[],recCount=0):
   if recCount == 0:
      #boardList holds lists of BoardCell instances. Its attributes are irrelevant.
      lst.append[self.boardList[rs][cs]]
   else:
    lst.append[self.boardList[r][c]]
  
   if rs + 1 &lt; len(self.boardlist) and cs + 1 &lt; len(self.boardlist[0]):
      return self.getDiag(rs,cs,rs+1,rs+1,lst,recCount+1)
  </code></pre>