|
|
|
|
|
by layer8
298 days ago
|
|
Honestly, I find using intermediate variables more readable than a long chain of function invocations where you have to keep track of intermediate results in your head: input_groups = input_list.split(None)
group_sums = map(sum, input_groups)
max_sum = max(group_sums)
This also gives you a slightly higher-level view on how the algorithm proceeds just by reading the variable names on the LHS. |
|
I prefer python comprehensions for the same reason. I can tell that they are about crating a list or a dict and I don't need to parse a bunch of operations in a loop to come to the same conclusion.