Write this accumuator in a functional style
Gregory Ewing
greg.ewing at canterbury.ac.nz
Wed Jul 12 01:47:50 EDT 2017
Steve D'Aprano wrote:
> - Greg's dict comprehension version requires N+1 passes through the data,
> one to convert to a list, and 1 per each possible key.
Just to be clear, my solution was a response to the requirement
that it be written in a purely functional style. It's not now I
would actually recommend doing it!
While a purely functional single-pass solution is possible,
in Python it would probably be just as inefficient, maybe
even worse.
--
Greg
More information about the Python-list
mailing list