Here are full listings for some scripts that were too long to fit in the main text. Also included are scripts used to generate some of the tables and data fixtures used in this book.
These scripts are also available in the Fluent Python code repository, along with almost every other code snippet that appears in the book.
While coding Example A-1, I found something that really puts
dict performance in perspective. If the script is run in “verbose mode” (with the
-v command-line option), the timings I get are nearly twice those in Table 3-5. But note that, in this script, “verbose mode” means only four calls to
Container ``in`` operator performance test
selected = array.array('d')
with open('selected.arr', 'rb') as fp: