title: Python, finding neighbors in a 2-d list
body: <p>So here's the issue, I have a 2-d list of characters 'T' and 'F', and given coordinates I need to get all of its neighbors. I have this:</p>
  
  <pre><code>from itertools import product, starmap
  x, y = (5, 5)
  cells = starmap(lambda a, b: (x + a, y + b), product((0, -1, +1), (0, -1, +1))) 
  </code></pre>
  
  <p>from <a href="https://stackoverflow.com/questions/1620940/determining-neighbours-of-cell-two-dimensional-list">determining neighbors of cell two dimensional list</a> But it will only give me a list of coordinantes, so i still fetch the values afterwords. I'd like the search and retrieval done in one step, so findNeighbors(5,5) would return F,T,F,F,... instead of (5, 4), (5, 6), (4, 5), (4, 4)... Is there a fast way of doing this? The solutin can include a structure other than a list to hold the initial information </p>