Why does the following code produce the result? The LHS and RHS structure is different yet,this is the result..
[[w,x],[[y],z]]=[{10,20},[(30,),40]]
w
10
x
20
y
30
z
40
It's actually not guaranteed that w and x will always produce the same result, in dependence of your Python interpreter. Try switching it to:
>>> [[w,x],[[y],z]]=[{20,10},[(30,),40]]
>>> w
10
That's because the first 'entry' is a set and sets are not guaranteed to be ordered. The rest will work pretty much as expected because tuples and lists are ordered. It doesn't matter of the actual type on both sides so long as there is a parity, i.e. (x, y) = [p, q] will work the same as [x, y] = (p, q).