I recently studied Python
and encountered some questions about meta-ancestors and lists, as follows:
Python
version is 3.6
the code is as follows:
[1, 2] + [[3]] -sharp -> [1, 2, [3]]
(1, 2) + ((3),) -sharp (1, 2, 3), (1, 2, (3))?
-sharp ,
(1, 2, (((3)))) -sharp -> (1, 2, 3)
(1, 2) + (3, ) -sharp -> (1, 2, 3)
there are two problems
- Why tuples can also be added. I understand that Yuanzu is an immutable object, so why can I add it?
- Why can"t you nest Yuanzu? As shown in the above example, all the results are transformed into "one-dimensional" tuples, and the principle is not well understood?
I would like to have an answer from my seniors. I would appreciate it.