Discrete table (hash table), copy depth

Discrete table

  1. Out of order

  2. Unrepeatable

  3. key is not the variable data type

import hashlib

m = hashlib.md5()
# m.update(b'a')  # 0cc175b9c0f1b6a831c399e269772661
# m.update(b'b')  # 92eb5ffee6ae2fec3ad71c777531578f
# m.update(b'c')  # 4a8a08f09d37b73795649038408b5f33
# m.update(b'd')  # 8277e0910d750195b448797616e091ad
m.update(b'a')  # 0cc175b9c0f1b6a831c399e269772661
print(m.hexdigest())

1. First key hashed done (energy can hash processing for all data types): Mersenne Twister (pseudo-random number generation) -> by hashing he can generate a key for each sequence ( never repeat the same thing hashed into the same result)

2. Use a hash function sequence just generated (pure digital), in addition to pure digital modulo 9 (0,1,2,3,4,5,6,7,8)

 

Copy depth

Copy / Copy shallow / deep copy of the data types are variable terms for the

id constant value of the variable, i.e., modified on the basis of the original value, for the variable data type; id value becomes variable, i.e., to re-apply a new value into the space, compared with immutable data types.

copy

When l1 l2 is a copy of the object, converting l1, l2 change

Shallow copy

When l1 l2 as a pale copy of the object, an internal data type changes immutable l1, l2 unchanged; data type change in internal variable l1, l2 becomes

Deep copy

When deep copy of the object l2 to l1, l1 internal changes, l2 unchanged

 

Guess you like

Origin www.cnblogs.com/fjn839199790/p/11610127.html