How do you grep through code that lives in many different directories?
grep -r -n "PATTERN" --include="*.py" DIRECTORY
I would strongly recommend ack, a grep substitute, "aimed at programmers with large trees of heterogeneous source code" (from the website)
find DIRECTORY -name "*.py" | xargs grep PATTERN
By the way, since writing this, I have discovered ack, which is a much better solution.
(And since that edit, I have discovered ag).