Python integer size pool with shades copy

A small integer pool

A variable data types: list dict set

Variable: the type of data that is inside has changed, but at the memory address has not changed.

Immutable data type: str value tuple type

Immutable: If you change the value inside, just the corresponding memory address also changes. So as immutable data types

Small integer pool: -5--256 value in this pool which are created in advance good


Two, intern mechanism (large integer pool for string storage)

Large integer pool: storing character string containing standard (numbers, letters, underlined), a string comprising the special characters are not
added to the pool of large integer

example:
A = "123"
B = "123"
A = B IS True
Note: two at the memory address is the same as

C = "# 123"
D = "# 123"
C = D iS False
Note: these two points to the memory address is not the same

Guess you like

Origin www.cnblogs.com/666666pingzi/p/10947322.html