Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, package names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The size_list
variable is a sequence of eight-tuples built from the bytes of the encoded size."
A block of code is set as follows:
message_bytes= message.encode("UTF-8") bits_list = list(to_bits(c) for c in message_bytes ) len_h, len_l = divmod( len(message_bytes), 256 ) size_list = [to_bits(len_h), to_bits(len_l)] bit_sequence( size_list+bits_list )
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
w, h = ship.size
for p,m in enumerate( bit_sequence(size_list+bits_list) ):
y, x = divmod( p, w )
r, g, b = ship.getpixel( (x,y) )
r_new = (r & 0xfe) | m
print( (r, g, b), m, (r_new, g, b) )
ship.putpixel( (x,y), (r_new, g, b) )
Any command-line input or output is written as follows:
$ python3.3 -m doctest ourfile.py
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "There is an Advanced Settings panel that defines these file associations."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.