What is the difference in these two statements in python?
var = foo.bar
and
var = [foo.bar]
I think it i
I think it is making var into a list containing foo.bar but I am unsure. Also if this is the behavior and foo.bar is already a list what do you get in each case?
Yes, it creates a new list.
If foo.bar
is already a list, it will simply become a list, containing one list.
h[1] >>> l = [1, 2]
h[1] >>> [l]
[[1, 2]]
h[3] >>> l[l][0]
[1, 2]