There are two list words with ' extend ', ' + = ' and ' + ' can be used to achieve two lists of connections, but they are in object creation and memory allocation is different. At first Jia_dai to tell me that ' extend ' and ' + = ' are different on object creation. But later from Yusheng_ding learned to use the ID () function to see the variable ordinal. The experiment proves that ' extend ' and ' + = ' did not create a new object at the connection list, but appended the latter column to the previous Column object. When implemented with ' + ', a new long object is created, and the object is assigned to the variable on the left of ' = ', as shown in the following code.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Python Learning notes--the list of objects changes and memory allocations when doing extend,+= and +