This chapter covered an introduction to the basic object types of Python. The types we covered were:
Numbers have in common that all the basic operations of arithmetic work on them (+,-,*,/,**,%). Although they are divided into different types with different properties, particularly as regards the amount of memory they take up, For the most part we as users don’t need to think about these differences.
Containers all have sets of elements they contain;
(the contents of a container can always be verified using
in operator). For all the containers
discussed thus far, elements can be retrieved
with some kind of index, that is, for any container
retrieves the element indexed by index
In the case of tuples, strings, and lists, which are ordered
containers or sequences,
i is always an integer.
In the case of dictionaries, which are unordered,
i can be any legal key. Integers, strings,
and tuples of integers and strings are all legal
keys for dictionaries.
Containers can be separated into those that can be updated an those that cannot, the mutable containers, and the immutable containers:
Whenever sequenced data never needs to be changed, string and tuple representations should be considered, because they take less space.