seeking to improve Python skills
tjreedy at udel.edu
Fri Jan 23 23:26:09 CET 2009
> Jean-Paul Calderone wrote:
>> The most significant thing missing from this code is unit tests.
>> Developing automated tests for your code will help you learn a lot.
> Thanks for all the remarks, I'll restructure my code. Probably the
> biggest mistake was not keeping "moving average" class and others
> focused on its respective jobs only.
I would consider writing the moving-average 'function' as a generator
function. First version takes a sequence and window size as inputs.
Second, slightly more difficult, takes an iterator and window size as
inputs. An exponentially-weighted average generator would, of course,
take an iterator and weight as input.
More information about the Python-list