title: Determining neighbours of cell two dimensional list
body: <p>I have a list of lists, something like </p>
  
  <p><code>[[1, 2, 3,],[4, 5, 6,],[7, 8, 9]]</code>.</p>
  
  <p>Represented graphically as: </p>
  
  <pre><code>1 2 3
  4 5 6
  7 8 9
  </code></pre>
  
  <p>I'm looking for an elegant approach to check the value of neighbours of a cell, horizontally, vertically and diagonally. For instance, the neighbours of [0][2] are [0][1], [1][1] and [1][2] or the numbers 2, 5, 6. </p>
  
  <p>Now I realise, I could just do a bruteforce attack checking every value a la:</p>
  
  <pre><code>[i-1][j]
  [i][j-1]
  [i-1][j-1]
  [i+1][j]
  [i][j+1]
  [i+1][j+1]
  [i+1][j-1]
  [i-1][j+1]
  </code></pre>
  
  <p>But thats easy, and I figured I can learn more by seeing some more elegant approaches.</p>