3 ms·
I got annoyed with Go when I learnt how hard it is to sort arbitrary lists. Doing the following in Go is quite a pain: scores = [{'name': 'Bob', 'score': 20},
by herge 13y ago
I got annoyed with Go when I learnt how hard it is to sort arbitrary lists. Doing the following in Go is quite a pain:
scores = [{'name': 'Bob', 'score': 20}, {'name': 'Jane', 'score': 15}]
scores.sort(key=lambda x: x['score'])
- skybrian 13y agoYes, there is in practice a fair bit of boilerplate in Go. (The way you'd do it in this case is by defining two new types for a struct and a slice of structs. Not that hard once you know the trick.) Still, they got tiny types right, and without getting bogged down in dimensional analysis.