Chapter One: The Basics
Chapter Two: deep and shallow copy copy
Copy definition: For an object, it's how to create a copy of it? In other words, how to create another object with the same value with the object of it.
1. shallow copy
The so-called shallow copy, means that: for an object, while another object having the same value of the object is created, however, the two internal nested objects corresponding to all sub-objects are the same object. Simply put, a copy externally, no internal copy.
The following embodiment is shallow copy copy obtained:
1. slicing [:]
2. Call list, dictionary, collection methods copy ()
3. Call the built-in function list (), dict (), set ()
4. Call copy function copy of the standard library module ()
2. Variable immutable object. (Integer not change, because it is immutable)
3. For immutable objects are not nested sub-objects, for example: integer, strings, and a tuple object, etc., will not be copied, i.e., does not create another object.