by orangecat · 2y ago · 0 comments
Because in many cases a function is tightly associated with a particular context, and making it a separate named function is actually harmful for understanding.
personally, in python, I refuse to use lambda functions on ethical grounds
Do you really find this:
def get_name(x):
return x.name
sorted_by_name = sorted(people, key=get_name)
more readable than: sorted_by_name = sorted(people, key=lambda x: x.name) sorted_by_name = people.sort { it.name }Also due to the multiple style choices and options in JavaScript the readability is trash.