Glossary 8
list: A named collection of objects, where each object is identified by an index.
index: An integer variable or value that indicates an element of a list.
element: One of the values in a list (or other sequence). The bracket operator selects elements of a list.
sequence: Any of the data types that consist of an ordered set of elements, with each element identified by an index.
nested list: A list that is an element of another list.
list traversal: The sequential accessing of each element in a list.
object: A thing to which a variable can refer.
aliases: Multiple variables that contain references to the same object.
clone: To create a new object that has the same value as an existing object. Copying a reference to an object creates an alias but doesn’t clone the object.
delimiter: A character or string used to indicate where a string should be split.
Glossary 9
immutable type: A type in which the elements cannot be modified. Assignments to elements or slices of immutable types cause an error.
mutable type: A data type in which the elements can be modified. All mutable types are compound types. Lists and dictionaries are mutable data types; strings and tuples are not.
tuple: A sequence type that is similar to a list except that it is immutable. Tuples can be used wherever an immutable type is required, such as a key in a dictionary.
tuple assignment: An assignment to all of the elements in a tuple using a single assignment statement. Tuple assignment occurs in parallel rather than in sequence, making it useful for swapping values.
deterministic: A program that does the same thing each time it is called.
pseudorandom: A sequence of numbers that appear to be random but that are actually the result of a deterministic computation.
histogram: A list of integers in which each element counts the number of times something happens.
pattern matching: A program development plan that involves identifying a familiar computational pattern and copying the solution to a similar problem.
Glossary 10
dictionary: A collection of key-value pairs that maps from keys to values. The keys can be any immutable type, and the values can be any type.
key: A value that is used to look up an entry in a dictionary. key-value pair: One of the items in a dictionary.
method: A kind of function that is called with a different syntax and invoked “on” an object.
invoke: To call a method.
hint: Temporary storage of a precomputed value to avoid redundant computation. 10.8 Glossary 115
overflow: A numerical result that is too large to be represented in a numerical format.
Glossary 11
file: A named entity, usually stored on a hard drive, floppy disk, or CD-ROM, that contains a stream of characters.
directory: A named collection of files, also called a folder.
path: A sequence of directory names that specifies the exact location of a file.
text file: A file that contains printable characters organized into lines separated by newline characters.
break statement: A statement that causes the flow of execution to exit a loop.
continue statement: A statement that causes the current iteration of a loop to end. The flow of execution goes to the top of the loop, evaluates the condition, and proceeds accordingly.
format operator: The % operator takes a format string and a tuple of expressions and yields a string that includes the expressions, formatted according to the format string.
format string: A string that contains printable characters and format sequences that indicate how to format values.
format sequence: A sequence of characters beginning with % that indicates how to format a value.
pickle: To write a data value in a file along with its type information so that it can be reconstituted later.
exception: An error that occurs at runtime.
handle: To prevent an exception from terminating a program using the try and except statements.
Raise: To signal an exception using the raise statement.