dya6 small data pool, deep and shallow copy

Little knowledge points:

1. id: the memory address of the test content

s = 'abc'
print(id(s)
》》》
2174306953568

2, is: to determine whether the memory addresses are equal

s = 'abc'
s1 = 'abc'
print(s is s1)
》》》
Ture

3. Small data pool: share the same id (that is, if within this range, a and b are assigned the same value, then their memory addresses are the same)

int: -5~~~256 There is a small data pool concept

str: contains only numbers or letter elements, a single letter *int (within 20) has the concept of a small data pool

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325585342&siteId=291194637