Associative Arrays, Hash Maps, hash()
- VC Healy
- Jul 26, 2020
- 1 min read
Haven't written much in a bit for various reasons.
Hopefully, this is me back on track
Associative array in Python invariably means a form of a dictionary. Behind most objects there is a dictionary. It is the link between a key-value pair.
A symbol(variable) given string value is a key-value pair and a collection of these would give you a dictionary. A tuple of key-value pairs would be considered this.
The DDP Part 3 course goes into how these are handled by Python.
The hash of maps will ensure values that are the same will have the same hash value, although for security reasons the hash value(integer) could be different for each run of the code. Equivalent values would always be equal though.
It is an interesting topic and something I will look to review again in the coming days.
Comments