[x] means a list containing one item: x .
[[x]] means a list containing one element: a list containing one element: x .
So, if you say x is 4 , then [x] = [4] is a list containing only 4 , and [[x]] = [[4]] is a list containing only a list containing only 4.
As you can see, [x] just puts x into the list on its own. If x = [1, 2, 3] (that is, x is the list itself), then you probably do not want to call the function with [x] (= [[1, 2, 3]]) , because then you give her a list containing your source list, and not the list itself. Of course, this may be completely legal and necessary in certain cases, but if you are not sure, it most likely will not be needed.
So, if you have foo - this is an int list , and then print_foo [foo] is called, you say: "Print this list containing the list that I want to print." What you probably want to say is print_foo foo , where you leave the list wrapper redundant. This can be interpreted as "Print this list that I want to print."
source share