I'm new to Go, and quite excited about it. But, in all the languages I've worked with extensively: Delphi, C#, C++, Python - Lists are very important because they can be dynamically resized, as opposed to arrays.
In Golang, there is indeed a list.List
struct, but I see very little documentation about it - whether in Go By Example or the three Go books that I have - Summerfield, Chisnal and Balbaert - they all spend a lot of time on arrays and slices and then skip to maps. In souce code examples I also find little or no use of list.List
.
It also appears that, unlike Python, Range
is not supported for List - big drawback IMO. Am I missing something?
Slices are certainly nice, but they still need to be based on an array with a hard coded size. That's where List comes in. Is there a way to create an array /slice in Go without a hard coded array size? Why is List ignored?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…