when I try to assign a list to 2 variables, the following 2 ways get different results?
# way1
a,b = [[None,None],[None,None]]
# way2
c,d = [[None,None]]*2
a and b have different addresses on memory caches, while c and d have the same one.
print(id(a),id(b))
# out: 5243249856 5243249472
print(id(c),id(d))
# out: 5243246016 5243246016
The right-side lists are completely the same, the only difference is the way to create the list (way2 uses a '*' to expand the list). However, the left-side get different results. How is this happen? any one have any idea?