On 04/05/2018 03:24 PM, Peter O'Connor wrote:
Well, whether you factor out the loop-function is a separate issue. Lets say we do:
smooth_signal = [average = compute_avg(average, x) for x in signal from average=0]
Is just as readable and maintainable as your expanded version, but saves 4 lines of code. What's not to love?
It is not readable and it is not Python (and hopefully never will be).