Kyle Lahnakoski wrote:

Consider Serhiy Storchaka's elegant solution, which I reformatted for

smooth_signal = [
   for average in [0]
   for x in signal
    for average in [(1-decay)*average + decay*x]

"Elegant" isn't the word I would use, more like "clever".
Rather too clever, IMO -- it took me some head scratching
to figure out how it does what it does.

And it would have taken even more head scratching, except
there's a clue as to *what* it's supposed to be doing:
the fact that it's assigned to something called
"smooth_signal" -- one of those "inaccurate names" that
you disparage so much. :-)

Python-ideas mailing list
Code of Conduct:

Reply via email to