3 ms·
I don't see how that example is relevant, because: (1) It shows Python expresses the concept fairly compactly in the core language without even resorting to st
by dragonwriter 7y ago
I don't see how that example is relevant, because:
(1) It shows Python expresses the concept fairly compactly in the core language without even resorting to stdlib,
(2) It ignores an option (also in the core language) using a ternary and the truthiness of lists:
my_list[0] if my_list else None
- tanin 7y agoWhile what you say is true, my small example shows that the code is longer in Python for solving the same problem, i.e. `my_list[0] if my_list else None` is longer than `my_list.headOption` or `my_list.first`. And we are talking about the brevity of a language here.