September 2026
1051 pages
35h 4m
English
The list is a very flexible sequential data type that can accommodate arbitrarily long sequence of elements. This section describes the tuple, a data type closely related to the list.
Unlike the list, the tuple is immutable, which opens the possibility of calculating hash values for tuples. This property is important for the use of tuples in combination with data types like the dictionary or the set (see Chapter 13), which are based on hash tables. Based on the condition that hash values can also be calculated for all elements of a tuple, it may therefore be used as a key in a dictionary or as an element in a set, which differentiates it from a list.
The concept of a tuple is related to that of the list, but due ...
Read now
Unlock full access