seeking to improve Python skills
Terry Reedy
tjreedy at udel.edu
Fri Jan 23 17:26:09 EST 2009
mk wrote:
> Jean-Paul Calderone wrote:
> <snip>
>> 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
mailing list