K
Kottiyath
When we say readability counts over complexity, how do we define what
level of complexity is ok?
For example:
Say I have dict a = {'a': 2, 'c': 4, 'b': 3}
I want to increment the values by 1 for all keys in the dictionary.
So, should we do:.... a[key] = a[key] + 1
or is it Ok to have code like:
dict(map(lambda key: (key, a[key] + 1), a))
How do we decide whether a level of complexity is Ok or not?
level of complexity is ok?
For example:
Say I have dict a = {'a': 2, 'c': 4, 'b': 3}
I want to increment the values by 1 for all keys in the dictionary.
So, should we do:.... a[key] = a[key] + 1
or is it Ok to have code like:
dict(map(lambda key: (key, a[key] + 1), a))
How do we decide whether a level of complexity is Ok or not?