I'm a little curious about some of the style choices in python code. For example: # used by Sebastian for k in range(len(measurements)): p = sense(p, measurements[k]) vs # shorter, saner, and more Pythonic for m in measurements: p = sense(p, m) I guess the old aphorism applies: a good Pascal programmer can write Pascal in any language. (Not to criticize Sebastian's programming ability, only to wonder about the pedago…
def move(p, U):
q = []
for i in range(len(p)):
s = pExact * p[(i-U) % len(p)]
s = s + pOvershoot * p[(i-U-1) % len(p)]
s = s + pUndershoot * p[(i-U+1) % len(p)]
q.append(s)
return q
where the index is used to access the previous and next elements in a list.There's a more idiomatic way to get this index variable(http://stackoverflow.com/questions/522563/accessing-the-inde...), but using a consistent, easy to understand iteration method allows the poor confused student (i.e. me) to spend more time focusing on the concept being taught.
So the code could be intentional, or could be an accident. But I expect that sooner rather than later there will be some data to show which method, if any, is better for the students, and the classes will be adjusted accordingly.
By the way, did anyone else find these exercises addictive? I can begin to appreciate why the Farmville cow-clickers keep at it.