Kyle Lahnakoski wrote:

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

smooth_signal = [
    average
   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. :-)

--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to