Program comprehension is a fascinating (and IMHO very enlightening) field.<p>For anyone curious, I wrote up some of what I learned while exploring the research a few years ago:
<a href="http://www.clarityincode.com/readability/" rel="nofollow">http://www.clarityincode.com/readability/</a>
(I apologise for the less than stellar formatting; I haven’t updated that page for some time. I also apologise to the actual researchers I cited, if I’ve dumbed down their work too much in aiming for a non-expert audience.)<p>For the eye tracking reported here, I wonder whether the early emphasis on the top part was a combination of trying to figure out the data flow in the between() function and then its significance to the wider program.<p>I think it would be interesting to compare the results with a similar eye track of a program written with more emphasis on data flow rather than control flow, e.g.,<p><pre><code> def between(numbers, low, high):
return [n for n in numbers if low < n < high]
def common(list1, list2):
return [i for i in list1 if i in list2]
x = [2, 8, 7, 9, -5, 0, 2]
x_btwn = between(x, 2, 10)
print x_btwn
y = [1, -3, 10, 0, 8, 9, 1]
y_btwn = between(y, -2, 9)
print y_btwn
xy_common = common(x, y)
print xy_common
</code></pre>
It might also be interesting to compare the results with a functional programming language that expresses those ideas more concisely and/or with tools like between() and common() as part of the standard library that programmers would probably be familiar with.<p>Final thought: How much does the absence of a clearly marked starting point (like a main() function in C) affect how a reader approaches unknown code in Python? If this had been a C program, would the reader have aimed straight for main() and then worked down from there to functions like between() and common()?