! debugger command, pdb module, 187
!= not equal to operator, 66
#! in Unix shell scripts, 6, 176
rewriting on package installation, 153
% modulo operator, 65
% string formatting operator, 8, 70, 162
%= operator, 75
& bitwise-and operator, 65
& set intersection operator, 15, 75
&= operator, 75
() function call operator, 76
* keyword only arguments, Python 3, 625
* multiplication operator, 65
* passing sequences as function arguments, 94
* sequence replication operator, 67
* variable arguments in function definition, 94
* wildcard
iterable unpacking in Python 3, 623
** passing dictionaries as keyword arguments, 95
** power operator, 65
** variable keyword arguments in function definition, 95
**= operator, 75
*= operator, 75
+ addition operator, 65
+ list concatenation operator, 12
+ sequence concatenation operator, 67
+ string concatenation operator, 11
+ unary plus operator, 65
+= operator, 75
- hyphen character, used as filename, 174
- set difference operator, 15, 75
- subtraction operator, 65
- unary minus operator, 65
-*- coding: comment, in source code, 31
-= operator, 75
. attribute binding operator, 33, 48, 76, 118
and modules, 51
special methods for, 57
. directory reference in relative import statements, 150
... interpreter prompt, 175
/ division operator, 65
// truncating division operator, 65
//= operator, 75
/= operator, 75
: colon in string formatting specifiers, 72
< left alignment in string format specifiers, 73
< less than operator, 66
<< left shift operator, 65
<<= operator, 75
<= less than or equal to operator, 66
> greater than operator, 66
> right alignment in string format specifiers, 73
>= greater than or equal to operator, 66
>> file redirection modifier to print, 10, 163
>> right shift operator, 65
>>= operator, 75
>>> interpreter prompt, 5, 175
[::] extended slicing operator, 39-40, 67-68
[:] slicing operator, 39-40, 67-68
[] indexing operator, 39-40, 67
and special methods, 58
on mappings, 45
on sequences, 68
line continuation character, 9, 25, 29
string escape codes, 27
^ bitwise-xor operator, 65
^ centered alignment in string format specifiers, 73
^ set symmetric difference operator, 15, 75
^= operator, 75
_ variable, interactive mode, 6, 176
{} placeholder in format strings, 72
{} set literal, Python 3, 622
| bitwise-or operator, 65
|= operator, 75
~ bitwise-negation operator, 65
~ expanding user home directory in filenames, 397
$variables in strings, 72
0b binary integer literal, 27
0o octal integer literal, 27
0x hexadecimal integer literal, 27
2’s complement and integers, 66
2to3 tool, 635-637
limitations of, 636
-3 command line option, 173, 635
‘a’ mode, to open() function, 159
a(args) debugger command, pdb module, 187
a2b_base64() function, binascii module, 547
a2b_hex() function, binascii module, 548
a2b_hqx() function, binascii module, 548
a2b_uu() function, binascii module, 547
abort() function, os module, 390
abort() method, of FTP objects, 497
operator module, 273
__abs__() method, 61
absolute imports, 151
Python 3, 634
compared to relative imports, 151
absolute value, 66
abspath() function, os.path module, 396
abstract base class, 34, 136, 257
calling methods in subclasses, 137
checking performed, 137
container objects, 265
error if instantiated, 137
example, 258
files and I/O, 354
numeric types, 253
registering pre-existing classes, 137
special methods for, 57
@abstractmethod decorator, 136-137, 257-258
__abstractmethods__ attribute, of types, 50
@abstractproperty decorator, 136-137, 257-258
accept() method
of Listener objects, 433
of dispatcher objects, 456
of socket objects, 478
accept2dyear variable, time module, 405
access control specifiers, lack of, 127
access() function, os module, 386
acos() function, math module, 251
acosh() function, math module, 251
acquire() method
of Condition objects, 441
of Lock objects, 438
of RLock objects, 438
of Semaphore objects, 439
activate() method, of SocketServer class, 493
active_children() function, multiprocessing module, 434
active_count() function, threading module, 443
ActivePython, 5
add() function, operator module, 273
add() method
of TarFile objects, 320
__add__() method, 60
add_data() method, of Request objects, 516
add_header() method
of Message objects, 555
of Request objects, 516
add_option() method, of OptionParser objects, 158, 375
add_password() method, of AuthHandler objects, 519
add_section() method, of ConfigParser objects, 332
add_type() function, mimetypes module, 567
add_unredirected_header() method, of Request objects, 517
addfile() method, of TarFile objects, 320
addFilter() method
of Handler objects, 364
of Logger objects, 359
addHandler() method, of Logger objects, 361
addition operator +, 65
addLevelName() function, logging module, 366
address attribute
of BaseManager objects, 431
of Listener objects, 433
address families, of sockets, 470
address_family attribute, of SocketServer class, 492
addresses, network, 471
addressof() function, ctypes module, 617
adjacent string literals, concatenation of, 27
adler32() function, zlib module, 328
advanced string formatting, 8, 42, 72
AF_* constants, socket module, 470
aifc module, 588
aio_* family of system calls, lack of, 469
AJAX, example of, 531
alarm() function, signal module, 399
alarms, 399
alias debugger command, pdb module, 187
alignment() function, ctypes module, 617
__all__ variable
and import statements, 145
in packages, 150
allow_reuse_address attribute, of SocketServer class, 492
altsep variable, os module, 386
altzone variable, time module, 405
and operator, boolean expressions, 9, 77
and_() function, operator module, 274
__and__() method, 60
__annotations__ attribute, of functions, 624
anonymous functions, 112
anydbm module, 310
api_version variable, sys module, 229
%APPDATA% environment variable, Windows, 177
of Element objects, 576
of array objects, 259
of deque objects, 262
appendChild() method, of DOM Node objects, 571
appendleft() method, of deque objects, 262
application logging, 355
applications, WSGI, 540
applicative order evaluation, 76
apply() method, of Pool objects, 424
apply_async() method, of Pool objects, 424
args attribute
of Exception objects, 213
of exceptions, 88
of partial objects, 268
argtypes attribute, of ctypes function objects, 613
argv variable, sys module, 13, 157, 174, 229
ArithmeticError exception, 87, 212
array module, 259
Array() function, multiprocessing module, 426
Array() method, of Manager objects, 428
array() function, array module, 259
arrays, creating from uniform type, 259
arraysize attribute, of Cursor objects, 299
as qualifier
of from-import statement, 145
as_integer_ratio() method, of floating point, 39
as_string() method, of Message objects, 555
ascii encoding, description of, 169
ascii() function, 201
and Python 3, 201
future_builtins module, 217
ASCII, and compatibility with UTF-8, 170
ascii_letters variable, string module, 287
ascii_lowercase variable, string module, 287
ascii_uppercase variable, string module, 287
asctime() function, time module, 405
asin() function, math module, 251
asinh() function, math module, 251
assert statement, 91
assert_() method, of TestCase objects, 185
assertAlmostEqual() method, of TestCase objects, 185
assertEqual() method, of TestCase objects, 185
AssertionError exception, 87, 91, 213
assertions, 91
stripping with -O option, 148
assertNotAlmostEqual() method, of TestCase objects, 185
assertNotEqual() method, of TestCase objects, 185
assertRaises() method, of TestCase objects, 185
assignment
and reference counting, 34
augmented, 61
in-place operators, 61
of instance attributes, 131
of variables, 7
to variables in nested functions, 97
associativity of operators, 78
astimezone() method, of datetime objects, 340
asynchat class, asynchat module, 452
asynchat module, 452
use of, 467
asynchronous I/O, 415
asynchronous networking
and blocking operations, 469
when to consider, 467
use of, 467
AsyncResult objects, multiprocessing module, 425
atan() function, math module, 251
atan2() function, math module, 251
atanh() function, math module, 251
atomic operations, disassembly, 193
attach() method, of Message objects, 556
attrgetter() function, operator module, 275
attrib attribute, of Element objects, 576
attribute assignment, on instances, 131
attribute binding operator ., 33, 76
optimization of, 196
attribute binding
and inheritance, 119
and methods, 48
instances and classes, 118
of user-defined objects, 131
process of, 57
redefining in classes, 132
special methods for, 57
attribute deletion, on instances, 131
attribute lookup in string formatting, 72
AttributeError exception, 87, 213
and attribute binding, 132
attributes attribute, of DOM Node objects, 570
attributes
computed as properties, 117, 124
creation in __init__() method, 118
encapsulation of, 127
lookup in composite string formatting, 42
of objects, 33
private, 127
restricting names with __slots__, 132
user defined on functions, 114
audioop module, 588
augmented assignment operators, 61, 75
authentication, fetching URLs, 519
authkey attribute, of Process objects, 416
awk UNIX command, similarity to list comprehensions, 111
-B command line option, 173
b character, before a string literal, 29
b(reak) debugger command, pdb module, 187
b16decode() function, base64 module, 547
b16encode() function, base64 module, 547
b2a_base64() function, binascii module, 547
b2a_hex() function, binascii module, 548
b2a_hqx() function, binascii module, 548
b2a_uu() function, binascii module, 547
b32decode() function, base64 module, 546
b32encode() function, base64 module, 546
b64decode() function, base64 module, 546
b64encode() function, base64 module, 546
backslash rules, and raw strings, 29
‘backslashreplace’ error handling, Unicode encoding, 166
BadStatusLine exception, http.client module, 504
base class, 21
base-10 decimals, 243
and floating point, 12
base64 encoding, description of, 545
base64 module, 545
BaseCGIHandler() function, wsgiref.handlers module, 542
BaseException class, 212
BaseException exception, 87
BaseHTTPRequestHandler class, http.server module, 508
BaseHTTPserver module, see http.server, 506
BaseManager() function, multiprocessing module, 430
basename() function, os.path module, 396, 398
BaseProxy class, multiprocessing module, 432
BaseRequestHandler class, SocketServer module, 490
__bases__ attribute
of classes, 131
of types, 50
basestring variable, 202
basicConfig() function, logging module, 355
BasicContext variable, decimal module, 248
.bat files, Windows, 176
bdb module, 585
Beautiful Soup package, 563
betavariate() function, random module, 255
bidirectional() function, unicodedata module, 293
big endian format, 167
big endian, packing and unpacking, 292
binary data structures, packing and unpacking, 290
binary distribution, creating with distutils, 153
binary file mode, 159
binary files, 350
buffered I/O, 351
caution on using line-oriented functions, 351-352
binary integer literals, 27
Binary() function
database API, 301
xmlrpc.client module, 526
binascii module, 547
bind() method
of SocketServer class, 493
of dispatcher objects, 456
of socket objects, 478
binhex module, 587
bisect module, 261
bisect() function, bisect module, 261
bisect_left() function, bisect module, 261
bisect_right() function, bisect module, 261
bitwise operations and native integers, 66
bitwise-and operator &, 65
bitwise-negation operator ~, 65
bitwise-or operator |, 65
bitwise-xor operator ^, 65
blank lines, 26
block_size attribute, of digest objects, 559
blocking operations, and asynchronous networking, 469
Bluetooth protocol, 470
address format, 472
BOM (byte order marker), 280
and Unicode, 168
BOM_* constants, codecs module, 280
bool type, 38
bool() function, 202
evaluation rules, 78
boolean operators, 66
boolean() function, xmlrpc.client module, 525
BoundedSemaphore object
multiprocessing module, 427
threading module, 439
BoundedSemaphore() method, of Manager objects, 428
break statement, 83-84
and generators, 103
breaking long statements on multiple lines, 9
breakpoint
setting in debugger, 187
setting manually, 186
browser, launching from Python, 544
BSD, kqueue interface, 460
BTPROTO_* constants, socket module, 477
buffer, circular, 262
buffer_info() method, of array objects, 259
buffered binary I/O, 351
BufferedIOBase abstract base class, 354
BufferedRandom class, io module, 352
BufferedReader class, io module, 351
BufferedRWPair class, io module, 352
BufferedWriter class, io module, 352
buffering, and generators, 165
build_opener() function, urllib.request module, 518
built-in functions and types, 201
built-in functions, using Python 3 functions in Python 2, 217
built-in types, 37
__builtin__ module, 201
builtin_module_names variable, sys module, 229
BuiltinFunctionType, 49
BuiltinFunctionType type, 47, 237
builtins module, Python 3, 201
byref() function, ctypes module, 615
byte literals, 29
byte strings, 41
and WSGI, 541
and files, 160
and system interfaces in Python 3, 630
as in-memory binary files, 352
decoding as Unicode, 165
different behavior in Python 3, 629
lack of formatting in Python 3, 629
mixing with Unicode strings, 70, 167
mutable byte arrays, 202
use in system interfaces, 633
bytearray() function, 202
byteorder variable, sys module, 229
bytes datatype, Python 3, 29
bytes() function, 202-203
bytes, escape code in strings, 28
BytesIO class, io module, 352
byteswap() method, of array objects, 259
bz2 module, 313
BZ2Compressor() function, bz2 module, 313
BZ2Decompressor() function, bz2 module, 314
BZ2File() function, bz2 module, 313
C extensions, 591
and .egg files, 147
and module reloading, 149
compiling with distutils, 596
creating with SWIG, 619
example with ctypes, 618
releasing global interpreter lock, 444
-c command line option, 173-174
C#, 620
c(ont(inue)) debugger command, pdb module, 188
C++, difference in class system, 119
C
Python variables compared to, 7
implementation of functions, 49
C/C++ code, in third-party packages, 154
C3 linearization algorithm, and inheritance, 121
c_* datatypes, ctypes module, 614
CacheFTPHandler class, urllib.request module, 518
caching results of a function, 242
calcsize() function, struct module, 291
calendar module, 588
call() function, subprocess module, 403
Callable abstract base class, 265
callable objects
and __call__() method, 62
classes, 50
instances, 50
types of, 47
callback functions, 98
and lambda, 112
calling Python functions from C, 610
_callmethod() method, of BaseProxy objects, 433
callproc() method, of Cursor objects, 298
cancel() method, of Timer objects, 438
cancel_join_thread() method, of Queue objects, 418
CannotSendHeader exception, http.client module, 504
CannotSendRequest exception, http.client module, 504
capitalize() method, of strings, 41-42
capitals attribute, of Context objects, 247
capwords() function, string module, 290
case conversion, of strings, 43-44
case sensitivity, of identifiers, 26
case statement, lack of, 9
cast() function, ctypes module, 617
catching all exceptions, 85
catching multiple exceptions, 85
category() function, unicodedata module, 170, 293
__cause__ attribute, of Exception objects, 213, 627
caution with range() function, 17
CDLL() function, ctypes module, 612
ceil() function, math module, 251
center() method, of strings, 41-42
cert_time_to_seconds() function, ssl module, 488
CGI script, 533
advice for writing, 537
environment variables, 533
executing XML-RPC server within, 529
running WSGI application, 542
use of databases, 538
web frameworks, 538
cgi module, 533
CGIHandler() function, wsgiref.handlers module, 542
CGIHTTPRequestHandler class, http.server module, 507
CGIHTTPServer module, see http.server, 506
cgitb module, 539
CGIXMLRPCRequestHandler class, xmlrpc.server module, 528
chain() function, itertools module, 270
chained comparisons, 66
chained exceptions, Python 3, 627
changing display of results, interactive mode, 176
changing module name on import, 144
changing the working directory, 379
changing user-agent header in HTTP requests, 517
character substitution, 42
characters() method, of ContentHandler objects, 581
characters
escape codes, 28
specifying Unicode, 28
chdir() function, os module, 379
check_call() function, subprocess module, 403
check_unused_args() method, of Formatter objects, 289
checking if running as main program, 146
checking multiple cases with a conditional, 9
chflags() function, os module, 386
chicken, multithreaded, 414
childNodes attribute, of DOM Node objects, 570
chmod() function, os module, 387
choice() function, random module, 254
chown() function, os module, 387
chroot() function, os module, 379
chunk module, 588
cipher() method, of ssl objects, 487
circular buffer or queue with deque objects, 262
cl(ear) debugger command, pdb module, 188
attribute binding of, 124
practical use of, 124
execution of class body, 138
class variables, 117
sharing by all instances, 118
__class__ attribute
of methods, 49
classes, 21
__del__() method and garbage collection, 221-222
__init__() method, 118
__init__() method and inheritance, 120
__slots__ attribute, 132
access control specifiers, lack of, 127
accessing in modules, 144
and metaclasses, 138
as callable, 50
as namespaces, 117
attribute binding rules, 118
class method, 203
creation of instances, 22, 55, 118
customizing attribute access, 57-58
decorators applied to, 102, 141
defining methods, 21
descriptor attributes, 58, 126
difference from C++ or Java, 119
inheriting from built-in types, 22
memory management, 128
mixin, 122
multiple inheritance, 120-121
object base class, 119
old-style, 139
operating overloading, 54
optimization of, 195
optimization of inheritance, 233
performance of __slots__, 196
pickling of, 228
private members, 26
redefining attribute binding, 132
scoping rules within, 118
self parameter of methods, 119
special methods, 54
static methods, 22
super() function in methods, 120
supporting pickle module, 228
type of, 47
uniform access principle, 125
versus dicts for storing data, 195
@classmethod decorator, 48, 123, 125, 203
ClassType type, old-style classes, 139
cleandoc() function, inspect module, 222
clear() method
of Element objects, 576
of Event objects, 440
of deque objects, 262
of dicts, 45
of sets, 46
clear_flags() method, of Context objects, 247
clear_memo() method, of Pickler objects, 228
_clear_type_cache() function, sys module, 233
clearing a dictionary, 45
clearing last exception, 233
Client class, multiprocessing module, 433
client program, 449
TCP example, 451
UDP example, 486
client_address attribute
of BaseHTTPRequestHandler objects, 509
of BaseRequestHandler objects, 490
clock() function, time module, 191, 405
cloneNode() method, of DOM Node objects, 571
close() function, os module, 381
close() method
of Connection objects, 297, 421
of Cursor objects, 298
of FTP objects, 498
of HTMLParser objects, 561
of HTTPConnection objects, 503
of Handler objects, 364
of IOBase objects, 349
of Listener objects, 434
of Pool objects, 424
of Queue objects, 418
of TarFile objects, 320
of TreeBuilder objects, 577
of ZipFile objects, 325
of dbm-style database objects, 310
of dispatcher objects, 456
of files, 159
of generators, 20, 53, 103, 105
of generators and synchronization, 104
of mmap objects, 371
of shelve objects, 311
of socket objects, 478
of urlopen objects, 515
close_when_done() method, of asynchat objects, 452
closed attribute
of IOBase objects, 349
of files, 161
closefd attribute, of FileIO objects, 350
closefd parameter, to open() function, 159
CloseKey() function, winreg module, 408
closerange() function, os module, 382
closing() function, contextlib module, 268
__closure__ attribute, of functions, 48, 100
closures, 98-99
and decorators, 101
and nested functions, 99
and wrappers, 100
speedup over classes, 100
cmath module, 251
cmd module, 588
cmp() function, 203
filecmp module, 314
cmpfiles() function, filecmp module, 314
co_* attributes, of code objects, 51-52
code execution, in modules, 143-144
code migration
Python 2 to 3, 634
practical strategy for, 637
code module, 585
code objects, 51
attributes of, 51
creating with compile() function, 115
code point, Unicode, 28
__code__ attribute, of functions, 48
code, executing strings, 115
CodecInfo class, codecs module, 277
removal of compression codecs, 280
use of byte strings, 280
coded_value attribute, of Morsel objects, 512
codeop module, 585
__coerce__() method, deprecation of, 134
coercion of numeric types, 66-67
collect function, gc module, 179
collect() function, gc module, 220
collect_incoming_data() method, of asynchat objects, 452
collection, definition of, 33
colorsys module, 588
combinations() function, itertools module, 271
combine() method, of datetime class, 339
combining() function, unicodedata module, 294
command attribute, of BaseHTTPRequestHandler objects, 509
Python 3, 633
detecting settings in a program, 230
for interpreter, 173
parsing with optparse, 374
commands debugger command, pdb module, 188
commands module, 331
comment attribute, of ZipInfo objects, 327
Comment() function, xml.etree.ElementTree module, 575
commit() method, of Connection objects, 298
common attribute, of dircmp objects, 315
common_dirs attribute, of dircmp objects, 315
common_files attribute, of dircmp objects, 315
common_funny attribute, of dircmp objects, 315
commonprefix() function, os.path module, 396
communicate() method, of Popen objects, 403
comparison operators, 56
comparison, 66
Python 3, 633
chained, 66
of incompatible objects, 78
of objects, 34
of sequences, 70
of weak references, 242
compilation into bytecode, 148
re module, 283-284
compileall module, 585
compiler, lack of, 181
complete_statement() function, sqlite3 module, 305
Complex abstract base class, 253
cmath library module, 251
comparison of, 66
complex type, 38
__complex__() method, 61-62
and type coercion, 134
composing email messages, 555
composite string formatting, 8, 42, 72
and __format__(), 56
and lookups, 42
compress() function
bz2 module, 314
zlib module, 328
compress() method
of BZ2Compressor objects, 313
of compressobj objects, 328
compress_size attribute, of ZipInfo objects, 327
compress_type attribute, of ZipInfo objects, 327
compression
zlib compression, 328
CompressionError exception, tarfile module, 322
compressobj() function, zlib module, 328
computed attributes and properties, 124
concat() function, operator module, 274
concatenation
of adjacent string literals, 27
of lists, 12
of strings, 11
concurrency, 413
advice on multiprocessing, 435
and Python programs, 414
and side effects, 96
coroutines, 446
global interpreter lock, 414
limitations on multicore, 414
message passing, 413-415
multitasking with generators, 447
scaling issues, 415
synchronization problems, 414
concurrent programming, 413
Condition object
multiprocessing module, 427
threading module, 441
condition debugger command, pdb module, 188
condition variable, 441
Condition() method, of Manager objects, 429
conditional expressions, 79
ConfigParser class, configparser module, 332
configparser module, 332
configuration files, 332
difference from Python script, 334-335
for logging module, 368
variable substitution, 335
confstr() function, os module, 395
conjugate() method
of complex numbers, 39
of floating point, 39
connect() function
database API, 297
sqlite3 module, 304
connect() method
of BaseManager objects, 431
of FTP objects, 498
of HTTPConnection objects, 503
of SMTP objects, 514
of dispatcher objects, 456
of socket objects, 478
connect_ex() method, of socket objects, 478
connecting processes, multiprocessing module, 433
Connection class
database API, 297
sqlite3 module, 305
ConnectRegistry() function, winreg module, 408
console window, Windows, 176
Container abstract base class, 265
container objects, 29
and reference counting, 34
definition of, 33
containment test, in operator, 9
contains() function, operator module, 274
__contains__() method, 58
ContentHandler class, xml.sax module, 581
ContentTooShort exception, urllib.error module, 523
Context class, decimal module, 244
context management protocol, 62
decimal module, 248
defining with generator, 267
locking, 442
nested, 267
__context__ attribute, of Exception objects, 213, 627
@contextmanager decorator, 90
continue statement, 83-84
control characters, stripping from a string, 42
conversion of strings to numbers, 11
conversion operations, 76
convert_field() method, of Formatter objects, 289
converting Python types to C, 611
converting dictionaries to a list, 16
converting sequences to a list, 77
converting sequences to a set, 15
converting sequences to a tuple, 77
converting types from C to Python, 602
converting types from Python to C, 597
Cookie module, see http.cookies, 511
CookieError exception, http.cookies module, 513
CookieJar class, http.cookiejar module, 513
cookielib module, see http.cookiejar, 513
cookies
HTTP, 511
fetching URLs with cookie support, 519
limitations of, 220
copy() function
copy module, 219
shutil module, 318
copy() method
of Context objects, 247
of dicts, 45
of digest objects, 559
of hmac objects, 560
of sets, 46
copy2() function, shutil module, 318
__copy__() method, 220
copy_reg module, 585
copyfile() function, shutil module, 318
copyfileobj() function, shutil module, 318
copying directories, 318
copying files, 318
copying
and reference counting, 35
deep copy, 36
dictionary, 45
of mutable objects, 35
shallow copy, 36
copymode() function, shutil module, 318
copyright variable, sys module, 230
copysign() function, math module, 251
copystat() function, shutil module, 318
copytree() function, shutil module, 318
@coroutine decorator example, 105
advanced example, 460
asynchronous I/O handling, 460
building a call stack of, 463
concurrency, 108
concurrent programming, 446
example of, 20
execution behavior, 105
multitasking example, 447
practical use of, 107
recursion, 112
sending and returning values, 106
task scheduler with select(), 460
transferring control to another coroutine, 463
use of next() method, 104
use with network programming, 467
cos() function, math module, 251
cosh() function, math module, 251
count() function, itertools module, 271
count() method
of array objects, 260
of lists, 40
of strings, 42
counting, in loops, 83
countOf() function, operator module, 274
cp1252 encoding, description of, 169
cp437 encoding, description of, 169
cPickle module, 229
cProfile module, 190
CPU, obtaining number on system, 434
CPU-bound tasks and threads, 444
cpu_count() function, multiprocessing module, 434
CRC attribute, of ZipInfo objects, 327
crc32() function
binascii module, 548
zlib module, 328
crc_hqx() function, binascii module, 548
create_aggregate() method, of Connection objects, 305
create_collation() method, of Connection objects, 306
create_connection() function, socket module, 473
create_decimal() method, of Context objects, 247
create_function() method, of Connection objects, 305
create_socket() method, of dispatcher objects, 456
create_string_buffer() function, ctypes module, 617
create_system attribute, of ZipInfo objects, 327
create_unicode_buffer() function, ctypes module, 617
create_version attribute, of ZipInfo objects, 327
created attribute, of Record objects, 359
CreateKey() function, winreg module, 408
creating a Windows installer, 153
creating a binary distribution, 153
creating a source distribution, 153
creating custom string formatters, 288
creating programs, 6
creating random numbers, 254
creating user-defined instances, 22
creation of instances, 118
steps involved, 129
creation of .pyc and .pyo files, 148
critical sections, locking of, 414
critical() method, of Logger objects, 357
crypt module, 586
crytographic hashing functions, 559
CSV data, example of reading, 14
CSV files
parsing, 548
type conversion of columns, 37
csv module, 548
ctermid() function, os module, 379
ctime() function, time module, 405
ctime() method, of date objects, 337
Ctrl-C, keyboard interrupt, 162
ctypes module, 612
array types, 614
available datatypes, 614
casting datatypes, 617
creating byte strings, 617
creating objects from buffers, 616
example of, 618
finding library modules, 612
loading shared libraries, 612
memory copying, 617
passing pointers and references, 615
pointer types, 614
setting function prototypes, 613
shared data with multiprocessing, 426
structure types, 615
cunifvariate() function, random module, 255
curdir variable, os module, 386
curly braces, and dictionary, 16
current time, obtaining, 405
_current_frames() function, sys module, 233
current_process() function, multiprocessing module, 434
current_thread() function, threading module, 443
currentframe() function, inspect module, 222
currying, and partial function evaluation, 76
curses module, 586
Cursor class, database API, 298
cursor() method, of Connection objects, 298
cwd() method, of FTP objects, 498
cycle() function, itertools module, 271
cycles, and garbage collection, 35
cyclic data structures, and __del__() method, 129
d(own) debugger command, pdb module, 188
daemon attribute
of Process objects, 416
of Thread objects, 436
daemonic process, 415
daemonic thread, 436
dangling comma
and print statement, 10
and tuples, 14
print statement, 162
data attribute, of DOM Text objects, 572
data encapsulation, 127
data structures
and dictionaries, 16
lists and tuples, 14
named tuples, 264
data() method, of TreeBuilder objects, 577
data-flow processing, and coroutines, 107
database API, 297
database interface, 297
and threads, 302
database results, converting into dictionaries, 303
and CGI script, 538
persistent dictionary, 171
DatabaseError exception, database API, 302
databases, DBM-style, 310
DataError exception, database API, 302
DatagramHandler class, logging module, 362
DatagramRequestHandler class, SocketServer module, 491
datagrams, 470
date and time manipulation, 336
date class, datetime module, 336
Date() function, database API, 301
date() method, of datetime objects, 340
date_time attribute, of ZipInfo objects, 327
DateFromTicks() function, database API, 301
datetime class, datetime module, 339
datetime module, 336
DateTime() function, xmlrpc.client module, 526
day attribute, of date objects, 337
daylight variable, time module, 405
dbhash module, 310
dbm module, 310
DBM-style databases, 310
deadlock, source with locking, 442
debug attribute
of TarFile objects, 320
of ZipFile objects, 325
of sys.flags, 230
debug() method, of Logger objects, 357
debugging
CGI scripts, 539
after an uncaught exception, 186
checking for memory leaks, 221
configuring the debugger, 190
entire programs from command shell, 189
manually setting a breakpoint, 186
pdb module, 186
running a function, 186
specifying a breakpoint, 187
use of logging module, 355
Decimal class, decimal module, 243
Decimal object, converting to a fraction, 250
and sum() function, 69
and threads, 249
rounding behavior, 245
decimal() function, unicodedata module, 295
declarative programming, 110
decode() function
base64 module, 547
quopri module, 568
decode() method
in Python 3, 629
of CodecInfo objects, 277
of IncrementalDecoder objects, 279
of JSONDecoder objects, 565
proper use of, 166
decodestring() function
base64 module, 547
quopri module, 568
decomposition() function, unicodedata module, 295
decompress() function
bz2 module, 314
zlib module, 328
decompress() method
of BZ2Decompressor objects, 314
of decompressobj objects, 328
decompressobj() function, zlib module, 328
applied to class definitions, 102, 141
copying function attributes, 269
documentation strings, 102, 113
example of, 101
multiple, 31
performance benefits, 197
user-defined function attributes, 102, 114
with arguments, 102
deep copy, 36
deepcopy() function, copy module, 219
__deepcopy__() method, 220
default Unicode encoding, 166, 177
default Unicode error handling policy, 167
and mutable values, 94
binding of values, 93
default() method, of JSONEncoder objects, 566
default_factory attribute, of defaultdict objects, 263
DefaultContext variable, decimal module, 248
defaultdict() function, collections module, 263
__defaults__ attribute, of functions, 48
defaults() method, of ConfigParser objects, 333
defects attribute, of Message objects, 554
defining functions, 18
defining multiple instance creation methods, 123
defining new exceptions, 88
degrees() function, math module, 251
del operator, on dictionaries, 16, 74
and __del__() method, 129
and slices, 40
deleting mapping items, 45
and program termination, 179
danger of defining, 129
garbage collection, 129, 221-222
uses of, 55
del_param() method, of Message objects, 556
delattr() function, 203
and private attributes, 128
__delattr__() method, 57-58, 131
delayed evaluation, 99
delayed execution, using threads, 437
delete() method, of FTP objects, 498
__delete__() method, of descriptors, 58, 126
DeleteKey() function, winreg module, 409
@deleter decorator of properties, 126
DeleteValue() function, winreg module, 409
deleting items from a dictionary, 16
deleting sequence items, 40
deletion of instance attributes, 131
delimiters, 30
delitem() function, operator module, 274
__delitem__() method, 58-59
and slices, 59
delslice() function, operator module, 274
demo_app() function, wsgiref.simple_server module, 542
denominator attribute
of Fraction objects, 250
of integers, 39
DeprecationWarning warning, 216, 238
deque object
collections module, 194
versus list, 194
deque() function, collections module, 262
DER_cert_to_PEM_cert() function, ssl module, 488
dereference attribute, of TarFile objects, 320
derived class, 119
description attribute, of Cursor objects, 299
and metaclasses, 140
detecting end of file (EOF), 160
detecting the settings of interpreter command line options, 230
devnull variable, os module, 386
Dialect class, csv module, 551
dict type, 38
__dict__ attribute
of classes, 131
of types, 50
of user-defined objects, 63
performance properties, 195
dict() method, of Manager objects, 429
dictionary comprehension, Python 3, 623
acceptable key types, 16
accessing items, 16
and Python 3 caution, 45
and __hash__() method, 56
automatic creation of initial values, 263
clearing, 45
compared to defaultdict objects, 263
converting to a list, 16
copying, 45
creating from database results, 303
creation with dict() function, 204
defining empty, 16
equality of, 78
indexing operator, 74
inserting items, 16
item assignment, 74
item deletion, 74
iterating over keys, 17
list of items, 45
lookup in composite string formatting, 42, 72
lookup with default value, 16
obtaining keys, 45-46
obtaining values, 45
performance of, 16
performance of in operator, 197
persistent with shelve module, 171
removing items, 16
shared by multiple processes, 429
tuples as keys, 74
updating, 45
use as a data structure, 16
use as a lookup table, 16
using functions as values, 37
using to pass keyword function arguments, 95
view objects in Python 3, 632
DictReader() function, csv module, 550
dicts, versus classes for storing data, 195
DictWriter() function, csv module, 550
diff_files attribute, of dircmp objects, 315
difference operator -, of sets, 15
difference() method, of sets, 46
difference_update() method, of sets, 46
difflib module, 586
dig attribute, of sys.float_info, 231
digest() method
of digest objects, 559
of hmac objects, 560
digest_size attribute, of digest objects, 559
digit() function, unicodedata module, 295
digits variable, string module, 287
hiding attribute names in classes, 128, 204
dir() method, of FTP objects, 498
__dir__() method, 63, 128, 204
dircmp() function, filecmp module, 314
directories
comparing, 314
copying, 318
reading files with shell wildcards, 317
recursive traversal, 390
system functions for accessing, 386
temporary, 323
testing filenames for, 397
dirname() function, os.path module, 396
dis module, 585
dis(), dis module, 193
disable debugger command, pdb module, 188
disable() function
gc module, 220
logging module, 366
disable_interspersed_args() method, of OptionParser objects, 376
disabling garbage collection, 220
disabling newline translation, 159
disassembly, 193
discard() method, of sets, 47
discard_buffers() method, of asynchat objects, 452
dispatcher class, asyncore module, 455
__displayhook__ variable, sys module, 230
displayhook() function, sys module, 176, 233
disposition attribute, of FieldStorage objects, 535
disposition_options attribute, of FieldStorage objects, 535
distributed computing, and multiprocessing module, 435
distributing programs, 152
distutils module, 152-153, 585, 596
and extension modules, 596
creating binary distributions, 153
creating extensions with SWIG, 620
div() function, operator module, 273
__div__() method, 60
division of integers, Python 3, 633
division operator /, 65
division operator, Python 2 versus Python 3, 61
division, truncation of integers, 61-62, 65
division_new attribute, of sys.flags, 230
division_warning attribute, of sys.flags, 230
__divmod__() method, 60
dllhandle variable, sys module, 230
DLLs
creating with distutils, 596
extension modules, 148
loading with ctypes, 612
do_handshake() method, of ssl objects, 487
__doc__ attribute
of built-in functions, 49
of methods, 49
of modules, 51
of objects, 30
of types, 50
DocCGIXMLRPCRequestHandler class, xmlrpc.server module, 528
doctest module, 181-182
verbose option, 182
Document class, xml.dom.minidom module, 571
documentation string, copying to decorator, 269
documentation strings, 24, 30, 48, 113
and XML-RPC, 527
and indentation, 30
doctest module, 181
in extension modules, 595
stripping with -OO option, 148
testing, 181
documentElement attribute, of DOM Document objects, 571
DocXMLRPCServer class, xmlrpc.server module, 527
DocXMLRPCServer module, 527
dollar-variable substitution, 163
DOM interface
XML parsing, 568
example of, 573
dont_write_bytecode attribute, of sys.flags, 230
dont_write_bytecode variable, sys module, 230
double precision floating point, 38
double-clicking on .py files, 6
double-underscores, use in identifiers, 26
dropwhile() function, itertools module, 271
dst() method
of time objects, 338
of tzinfo objects, 342
duck typing, 122
dumbdbm module, 310
dump() function
json module, 564
marshal module, 226
xml.etree.ElementTree module, 578
dump() method, of Pickler objects, 228
dumps() function
json module, 564
marshal module, 226
pickle module, 227
xmlrpc.client module, 526
dup() function, os module, 382
dup2() function, os module, 382
dynamic binding, of object attributes, 122
dynamic loading, of modules, 144
dynamic scope, lack of, 97
dynamic typing of variables, 7
-E command line option, 173
e variable, math module, 252
EAI_* constants, socket module, 485
east_asian_width() function, unicodedata module, 296
easy_install command, setuptools package, 155
.egg files, 154
and modules, 147
and site configuration, 177
structure of, 147
Element class, xml.dom.minidom module, 572
Element() function, xml.etree.ElementTree module, 575
ElementTree class, xml.etree.ElementTree module, 573
ElementTree interface, XML parsing, 569
ElementTree, examples of, 578
expression in Python 3, 626
type of, 51
use in extended slicing, 59
use in indexing methods, 54
else clause
of try statement, 86
of while and for loops, 84
email messages
composing, 555
example of composing and sending, 558
example of sending, 514
parsing, 552
email package, 552
Emax attribute, of Context objects, 247
embedding Unicode characters in web pages, 167
embedding the interpreter in C programs, 591, 608
embedding
calling functions from C, 610
converting Python types to C, 611
Emin attribute, of Context objects, 247
Empty exception, Queue module, 418, 445
empty dictionary, 16
empty list, 12
empty() method, of Queue objects, 418, 445
enable debugger command, pdb module, 188
enable() function
cgitb module, 539
gc module, 220
enable_callback_tracebacks() function, sqlite3 module, 305
enable_interspersed_args() method, of OptionParser objects, 376
enabling the print() function in Python 2.6, 163
encapsulation, 127
encode() function
base64 module, 547
quopri module, 568
encode() method
in Python 3, 629
of CodecInfo objects, 277
of IncrementalEncoder objects, 278
of JSONEncoder objects, 566
proper use of, 166
EncodedFile class, codecs module, 279
EncodedFile object, codecs module, 167
encodestring() function
base64 module, 547
quopri module, 568
encoding argument to open() function, 159
encoding attribute
of TextIOWrapper objects, 353
of files, 161
encoding issues with network programming, 452
encoding, of source code, 31
end attribute, of slices, 54
end keyword argument, to print() function, 163
end() method
of MatchObject objects, 286
of TreeBuilder objects, 577
end_headers() method, of BaseHTTPRequestHandler objects, 509
endDocument() method, of ContentHandler objects, 581
endElement() method, of ContentHandler objects, 581
endElementNS() method, of ContentHandler objects, 581
endheaders() method, of HTTPConnection objects, 503
endpos attribute, of MatchObject objects, 286
endPrefixMapping() method, of ContentHandler objects, 581
endswith() method, of strings, 42
__enter__() method, of context managers, 62, 89
threading module, 443
EnumKey() function, winreg module, 409
EnumValue() function, winreg module, 409
environ variable, os module, 158
environ variable, os module, 379
environment variables, 158, 379
Python 3, 633
WSGI, 540
expanding in filenames, 397
in CGI script, 533
unsetting, 381
used by interpreter, 174
EnvironmentError exception, 87, 212
EOF character, interactive mode, 7
EOF indication, file I/O, 160
epilogue attribute, of Message objects, 554
epoll interface, Linux, 460
epsilon attribute, of sys.float_info, 231
eq() function, operator module, 274
__eq__() method, 57
equality comparison of objects, 34
errcheck attribute, of ctypes function objects, 613
errno module, 343
error codes, list of system errors, 344
error exception, 396
socket module, 485
error messages, 157
error() method, of Logger objects, 357
error_message_format attribute, of BaseHTTPRequestHandler class, 508
errorcode variable, errno module, 344
errorlevel attribute, of TarFile objects, 320
errors attribute, of TextIOWrapper objects, 353
errors parameter
of encoding functions, 166
to open() function, 159
escape codes
disabling in a string literal, 29
in string literals, 27
non-printing characters, 28
escape() function
cgi module, 536
re module, 283
xml.sax.saxutils module, 583
escaping characters for use in HTML, 536
eval() function, 55, 77, 115, 204, 206
and repr(), 55
evaluation
of function arguments, 76
operator precedence and associativity, 78
order of, 78
Event object
multiprocessing module, 427
threading module, 440
event loop
and asyncore module, 455
coroutines, 108
Event() method, of Manager objects, 429
event-driven I/O, 415
polling for signals, 399
when to consider, 467
EX_* exit code constants, 391
exc_clear() function, sys module, 233
exc_info attribute, of Record objects, 359
exc_info() function, sys module, 53, 89, 233
change of syntax, 85
__excepthook__ variable, sys module, 230
excepthook() function, sys module, 85, 233
Exception class, 212
Exception exception, 87
exception handling, in extension modules, 605
exception() method, of Logger objects, 358
and locks, 23
attributes of, 212
catching all, 85
catching multiple types, 85
caution with catching all exceptions, 86
chained in Python 3, 626
clearing last exception, 233
defining new, 88
difference from warnings, 216
error codes for system errors, 344
finally statement, 86
handling of, 22-23
hierarchy of, 88
ignoring, 85
list of built-in, 87
matching rules, 85
optimization strategies, 196
performance of, 197
propagation of, 85
reraising the last exception, 84
.exe file, creating with distutils, 153
exec statement, caution with legacy code, 115
Python 3, 631
exec_prefix variable, sys module, 177, 230
execl() function, os module, 390
execle() function, os module, 390
execlp() function, os module, 390
executable variable, sys module, 230
execute() method
of Connection objects, 306
of Cursor objects, 298
executemany() method
of Connection objects, 306
of Cursor objects, 298
executescript() method, of Connection objects, 306
executing programs, 6
executing strings as code, 115
executing system commands, 331
popen() function, 392
subprocess module, 402
system() function, 393
execution model, 81
execution of __init__.py files, 150
execution of class bodies, 117, 138
execv() function, os module, 390
execve() function, os module, 391
execvp() function, os module, 391
execvpe() function, os module, 391
exists() function, os.path module, 396
_exit() function, os module, 179, 391
exit() function, sys module, 179, 233
__exit__() method, 63
exitcode attribute, of Process objects, 417
exp() function, math module, 251
exp() method, of Decimal objects, 243
expand() method, of MatchObject objects, 285
ExpandEnvironmentStrings() function, winreg module, 409
expandtabs() method, of strings, 41-42
expanduser() function, os.path module, 397
expandvars() function, os.path module, 397
exponents, range on floating point, 38
expovariate() function, random module, 255
expressions, 7
extend() method
of array objects, 260
of deque objects, 262
of lists, 40
on sequences, 68
extended slicing operator [::], 67
extended unpacking of iterables, Python 3, 623
ExtendedContext, decimal module, 248
extending with C, 591
extendleft() method, of deque objects, 262
extensible code, with modules, 144
extension modules, 591
compilation with distutils, 596
converting types from C to Python, 602
converting types from Python to C, 597
ctypes module, 612
difference in Python 3, 595
documentation strings, 595
exception handling, 605
global interpreter lock, 607
hand-written, 593
manual compilation, 597
naming of, 595
reference counting, 607
threads, 607
wrapper functions, 594
Extension() function, distutils module, 596
extensions_map attribute, of HTTPRequestHandler class, 508
external_attr attribute, of ZipInfo objects, 327
extra attribute, of ZipInfo objects, 327
extract() method
of TarFile objects, 320
of ZipFile objects, 325
extract_stack() function, traceback module, 236
extract_tb() function, traceback module, 236
extract_version attribute, of ZipInfo objects, 327
extractall() method, of ZipFile objects, 325
ExtractError exception, tarfile module, 322
extractfile() method, of TarFile objects, 320
extsep variable, os module, 386
F_* constants, fcntl() function, 347
f_* attributes
of frame objects, 52
of statvfs objects, 389
fabs() function, math module, 251
factorial() function, math module, 251
fail() method, of TestCase objects, 185
failIf() method, of TestCase objects, 185
failIfAlmostEqual() method, of TestCase objects, 185
failIfEqual() method, of TestCase objects, 185
failUnless() method, of TestCase objects, 185
failUnlessAlmostEqual() method, of TestCase objects, 185
failUnlessEqual() method, of TestCase objects, 185
failUnlessRaises() method, of TestCase objects, 185
failureException attribute, of TestCase objects, 185
family attribute, of socket objects, 484
Fault exception, xmlrpc.client module, 527
fchdir() function, os module, 379
fchmod() function, os module, 382
fchown() function, os module, 382
fcntl module, 347
fcntl() function, fcntl module, 347
fdatasync() function, os module, 382
fdopen() function, os module, 382
feed() method, of HTMLParser objects, 561
fetchall() method, of Cursor objects, 299
fetching URLs
example of, 514
example with authentication, 519
example with cookies, 519
fetchmany() method, of Cursor objects, 299
fetchone() method, of Cursor objects, 298
FieldStorage() function, cgi module, 534
file I/O, 10
file attribute, of FieldStorage objects, 535
file descriptors, 347
functions for manipulation, 382
file keyword argument, to print() function, 10, 163
file locking, 348
Windows, 373
by sqlite3 module, 303
file modes, use with open() function, 159
file upload, in CGI scripts, 536
__file__ attribute, of modules, 51
file-like objects, 122
file_offset attribute, of ZipInfo objects, 327
file_size attribute, of ZipInfo objects, 327
filecmp module, 314
fileConfig() function, logging module, 367
FileCookieJar class, http.cookiejar module, 513
FileHandler class
logging module, 362
urllib.request module, 518
FileIO class, io module, 350
filename attribute
of FieldStorage objects, 535
of Record objects, 359
of ZipInfo objects, 327
filenames
Windows drive letters, 399
absolute path of, 396
in Python 3, 633
matching with shell wildcards, 316
portable manipulation of, 396
splitting into directory and base name, 398
testing for existence, 396
testing if directory, 397
testing if link, 397
of Connection objects, 421
of IOBase objects, 349
of SocketServer objects, 491
of files, 160-161
of files and sockets, 459
of socket objects, 478
of urlopen objects, 515
files, 10
absolute path of, 396
and Python 3, 160
attributes of, 161
buffer size, 159
buffered binary I/O, 351
bz2 compression, 313
comparing, 314
copying, 318
creation time, 397
decoding as Unicode, 167
description of file modes, 159
detecting end of file (EOF), 160
finding on the filesystem, 390
functions for manipulating metadata, 386
gzip compression, 317
iterating over lines, 17-18
last modification time, 397
locking on Windows, 373
low-level control, 347
low-level system calls, 382
memory mapped, 370
methods on, 159
opening with Unicode decoding, 167
parsing CSV, 548
problems with io library module, 354
raw binary I/O, 350
reading line by line, 10
seeking, 161
size of, 397
softspace attribute and print statement, 162
temporary, 323
testing for existence, 396
types of, 159
writing to, 159
fill characters in string format specifiers, 73
Filter class, logging module, 359
filter() function, 205
and Python 3, 205
and optimization, 197
fnmatch module, 316
future_builtins module, 217
filterwarnings() function, warnings module, 239
finally statement, 86
and locks, 442
find() method
of Element objects, 576
of ElementTree objects, 574
of mmap objects, 371
of strings, 41-42
find_library() function, ctypes module, 612
findall() function, re module, 283
findall() method
of Element objects, 576
of ElementTree objects, 574
of Regex objects, 285
findCaller() method, of Logger objects, 358
finding all loaded modules, 144
finding files, 390
finditer() function, re module, 284
finditer() method, of Regex objects, 285
findtext() method
of Element objects, 576
of ElementTree objects, 574
finish() method, of BaseRequestHandler objects, 490
first-class objects, 36
use of, 37
firstChild attribute, of DOM Node objects, 570
flag_bits attribute, of ZipInfo objects, 327
flags attribute
of Context objects, 247
of Regex objects, 284
flags variable, sys module, 230
flaming death, in extension modules, 595
float type, 38
float() function, 13, 62, 76, 205
__float__() method, 61-62
and type coercion, 134
float_info variable, sys module, 231
floating point, 27
as dictionary key, 16
binary representation, 39
compared to decimal numbers, 243
converting to a fraction, 39, 250
defining NaN and Inf, 213, 252
inexact representation, 12, 243
low-level properties of, 231
mixing with complex numbers, 39
precision of, 38
random number distributions, 255
representation of, 38
FloatingPointError exception, 87, 213
flock() function, fcntl module, 348
floor division, 65
floor() function, math module, 251
floordiv() function, operator module, 273
__floordiv__() method, 60
flush() method
of BZ2Compressor objects, 314
of BufferWriter objects, 352
of Handler objects, 364
of IOBase objects, 349
of compressobj objects, 328
of decompressobj objects, 329
of files, 160
of mmap objects, 371
FlushKey() function, winreg module, 409
fma() method, of Decimal objects, 243
fmod() function, math module, 251
fnmatch module, 316
fnmatch() function, fnmatch module, 316
fnmatchcase() function, fnmatch module, 316
foot, how to shoot, 36, 86, 442, 617
for statement, 10, 17, 59, 69, 82
and generators, 19
and tuple unpacking, 15
forcing garbage collection, 220
foreign function interface, ctypes module, 612
fork() function, os module, 391
ForkingMixIn class, SocketServer module, 493
ForkingTCPServer class, SocketServer module, 494
ForkingUDPServer class, SocketServer module, 494
forkpty() function, os module, 392
format attribute, of Struct objects, 291
format codes
for dates and times, 406
for string formatting operator %, 70-71
format specifiers
alignment characters, 73
customized, 74
fill character, 73
format() method of strings, 72-74
nesting of fields, 74
format() function, 8, 11-12, 56, 77, 205
format() method
format specifier codes, 72
of Formatter objects, 288
of strings, 8, 42-43, 56, 72-73, 162
of strings and variable interpolation, 164
__format__() method, 55-56, 74
format_exc() function, traceback module, 236
format_exception() function, traceback module, 236
format_exception_only() function, traceback module, 236
format_list() function, traceback module, 236
format_stack() function, traceback module, 236
format_tb() function, traceback module, 236
format_value() method, of Formatter objects, 289
formatargspec() function, inspect module, 222
formatargvalues() function, inspect module, 222
formatted printing, 8, 70-71, 162
Formatter class
logging module, 365
string module, 288
formatter module, 587
formatting, of log messages, 358, 365
formatwarning() function, warnings module, 239
Fortran common blocks, lack of, 146
found_terminator() method, of asynchat objects, 453
fpathconf() function, os module, 382
fpectl module, 585
fpformat module, 586
Fraction class, fractions module, 250
fragment attribute
of urlparse objects, 520
of urlsplit objects, 521
frame objects, 51-52
attributes of, 52
free variables, in functions, 98
freeze_support() function, multiprocessing module, 434
frexp() function, math module, 251
from __future__ import, 178
global variables, 146
identifiers with underscores, 26
__all__ variable, 145
from statement
and import statement, 24
module imports, 145
from_address() method, of ctypes type objects, 616
from_buffer() method, of ctypes type objects, 616
from_buffer_copy() method, of ctypes type objects, 616
from_decimal() method, of Fraction class, 250
from_float() method, of Fraction class, 250
from_iterable() method, of objects, 270
from_param() method, of ctypes type objects, 616
fromfd() function, socket module, 473
fromfile() method, of array objects, 260
fromhex() method, of floating point, 39
fromkeys() method, of dicts, 45
fromlist() method, of array objects, 260
fromordinal() method
of date class, 336
of datetime class, 339
fromstring() function, xml.etree.ElementTree module, 575
fromstring() method, of array objects, 260
fromtimestamp() method
of date class, 336
of datetime class, 339
fromutc() method, of tzinfo objects, 342
fstat() function, os module, 383
fstatvfs() function, os module, 383
fsum() function, math module, 251
fsync() function, os module, 383
FTP server, uploading files to, 500
FTP() function, ftplib module, 497
FTPHandler class, urllib.request module, 518
ftplib module, 497
ftruncate() function, os module, 383
Full exception, Queue module, 418, 445
full() method, of Queue objects, 418, 445
func attribute, of partial objects, 268
__func__ attribute, of methods, 49
funcName attribute, of Record objects, 359
function call operator (), 47, 76
functions, 18
__doc__ attribute, 24
and coroutines, 20
and generators, 19
annotations in Python 3, 624
anonymous, 112
as closures, 98
as dictionary values, 37
as objects, 98
attributes and decorators, 102
attributes of, 48
binding of default values, 93
built-in, 201
callback, 98
change in func_* attribute names, 48
changing recursion limit, 112, 235
copying attributes to decorator, 269
creating wrappers for, 100
decorators, 101
decorators and attributes, 114
defining, 93
delayed execution with threads, 437
documentation strings, 48, 113
evaluation of arguments, 76
example of taking any number of arguments, 95
free variables, 98
lambda operator, 112
modifying global variables, 18
mutable parameters, 95
optional arguments and None, 38
parameter passing, 95
pickling of, 228
recursion, 112
returning multiple values from, 18, 96
running in the debugger, 186
side effects, 95
termination functions, 219
type of built-in, 49
type of user-defined, 47
user-defined, 48
user-defined attributes, 114
variable arguments, 94
variable number of keyword arguments, 95
functools module, 76, 114, 268
functor, 62
funny_files attribute, of dircmp objects, 315
future features, enabling, 178
__future__ module, 178
and division, 62
list of features, 178
future_builtins module, 217
FutureWarning warning, 216, 238
fuzzy date and time parsing, 343
gaierror exception, socket module, 485
gammavariate() function, random module, 255
garbage collection, 34-35, 220
and __del__() method, 129
and cycles, 35
and program termination, 179
description of process, 221
observer pattern example, 130
problem with __del__() method, 221
garbage variable, gc module, 220
gauss() function, random module, 255
gcd() function, fractions module, 251
gdbm module, 310
ge() function, operator module, 274
__ge__() method, 56
generator expressions, 109-110
conditional expressions, 79
converting into a list, 110
difference from list comprehension, 110
generator function, and context managers, 90
attributes of, 53
GeneratorExit exception, 87, 104, 213
and break statement in iteration, 103
and memory efficiency, 107
and processing pipelines, 19
closing, 53
concurrent programming, 446
execution model, 19
handling of GeneratorExit exception, 213
multitasking example, 447
practical use of, 106
recursion, 112
throwing exception in, 53
use with I/O, 164-165
use with WSGI, 165
get() function, webbrowser module, 544
get() method
of AsyncResult objects, 425
of ConfigParser objects, 333
of Element objects, 576
of Message objects, 552
__get__() method, of descriptors, 58, 126
get_all() method, of Message objects, 552
get_boundary() method, of Message objects, 552
get_charset() method, of Message objects, 553
get_charsets() method, of Message objects, 553
get_content_charset() method, of Message objects, 553
get_content_maintype() method, of Message objects, 553
get_content_subtype() method, of Message objects, 553
get_content_type() method, of Message objects, 553
get_count() function, gc module, 221
get_data() method, of Request objects, 517
get_debug() function, gc module, 221
get_default_type() method, of Message objects, 553
get_dialect() function, csv module, 551
get_errno() function, ctypes module, 617
get_field() method, of Formatter objects, 288
get_filename() method, of Message objects, 553
get_full_url() method, of Request objects, 517
get_host() method, of Request objects, 517
get_last_error() function, ctypes module, 617
get_logger() function, multiprocessing module, 435
get_method() method, of Request objects, 517
get_nowait() method, of Queue objects, 418, 445
get_objects() function, gc module, 221
get_origin_req_host() method, of Request objects, 517
get_osfhandle() function, msvcrt module, 372
get_param() method, of Message objects, 553
get_params() method, of Message objects, 553
get_payload() method, of Message objects, 554
get_referents() function, gc module, 221
get_referrers() function, gc module, 221
get_selector() method, of Request objects, 517
get_server_certificate() function, ssl module, 488
get_starttag_text() method, of HTMLParser objects, 561
get_terminator() method, of asynchat objects, 453
get_threshold() function, gc module, 221
get_type() method, of Request objects, 517
get_unixfrom() method, of Message objects, 554
get_value() method, of Formatter objects, 289
getaddrinfo() function, socket module, 473
getargspec() function, inspect module, 222
getargvalues() function, inspect module, 222
getatime() function, os.path module, 397
getattr() function, 205
and private attributes, 128
__getattr__() method, 57
and __slots__, 133
getAttribute() method, of DOM Element objects, 572
__getattribute__() method, 57-58, 132
and __slots__, 133
getAttributeNS() method, of DOM Element objects, 572
getboolean() method, of ConfigParser objects, 333
getch() function, msvcrt module, 372
getche() function, msvcrt module, 372
getcheckinterval() function, sys module, 234
getchildren() method, of Element objects, 577
getclasstree() function, inspect module, 222
getcode() method, of urlopen objects, 515
getcomments() function, inspect module, 223
getcontext() function, decimal module, 247
getctime() function, os.path module, 397
getcwd() function, os module, 379
getcwdu() function, os module, 379
getdefaultencoding() function, sys module, 166, 234
getdefaulttimeout() function, socket module, 474
getdlopenflags() function, sys module, 234
getdoc() function, inspect module, 223
getEffectiveLevel() method, of Logger objects, 360
getegid() function, os module, 379
getElementsByTagName() method
of DOM Document objects, 571
of DOM Element objects, 572
getElementsByTagNameNS() method
of DOM Document objects, 571
of DOM Element objects, 572
geteuid() function, os module, 380
getfile() function, inspect module, 223
getfilesystemencoding() function, sys module, 234
getfirst() method, of FieldStorage objects, 535
getfloat() method, of ConfigParser objects, 333
getfqdn() function, socket module, 474
_getframe() function, sys module, 234
getframeinfo() function, inspect module, 223
getgid() function, os module, 380
getgroups() function, os module, 380
getheader() method, of HTTPResponse objects, 504
getheaders() method, of HTTPResponse objects, 504
gethostbyaddr() function, socket module, 474
gethostbyname() function, socket module, 474
gethostbyname_ex() function, socket module, 474
gethostname() function, socket module, 474
getinfo() method, of ZipFile objects, 326
getinnerframes() function, inspect module, 223
getint() method, of ConfigParser objects, 333
getitem() function, operator module, 274
__getitem__() method, 58-59
and slices, 59
getiterator() method
of Element objects, 577
of ElementTree objects, 574
getitimer() function, signal module, 399
getLength() method, of SAX attributes objects, 582
getLevelName() function, logging module, 366
getlist() method, of FieldStorage objects, 535
getloadavg() function, os module, 395
getLogger() function, logging module, 356
getlogin() function, os module, 380
getmember() method, of TarFile objects, 320
getmembers() function, inspect module, 223
getmembers() method, of TarFile objects, 321
getmodule() function, inspect module, 223
getmoduleinfo() function, inspect module, 223
getmodulename() function, inspect module, 224
getmro() function, inspect module, 224
getmtime() function, os.path module, 397
getName() method, of Thread objects, 436
getNameByQName() method, of SAX attributes objects, 582
getnameinfo() function, socket module, 474
getNames() method, of SAX attributes objects, 582
getnames() method, of TarFile objects, 321
getopt module, 378
getouterframes() function, inspect module, 224
getoutput() function, commands module, 331
getpeercert() method, of ssl objects, 488
getpeername() method, of socket objects, 478
getpgid() function, os module, 380
getpgrp() function, os module, 380
getpid() function, os module, 380
getpos() method, of HTMLParser objects, 561
getppid() function, os module, 380
getprofile() function, sys module, 234
getprotobyname() function, socket module, 475
getQNameByName() method, of SAX attributes objects, 582
getQNames() method, of SAX attributes objects, 582
getrandbits() function, random module, 254
getrecursionlimit() function, sys module, 112, 234
getrefcount() function, sys module, 35, 234
getresponse() method, of HTTPConnection objects, 503
getroot() method, of ElementTree objects, 574
getservbyname() function, socket module, 475
getservbyport() function, socket module, 475
GetSetDescriptorType type, 237
getsid() function, os module, 380
getsignal() function, signal module, 399
getsize() function, os.path module, 397
getsizeof() function, sys module, 192, 234
getslice() function, operator module, 274
getsockname() method, of socket objects, 478
getsockopt() method, of socket objects, 478
getsource() function, inspect module, 224
getsourcefile() function, inspect module, 224
getsourcelines() function, inspect module, 224
getstate() function, random module, 254
__getstate__() method, 228
and copying, 220
and pickle module, 172
getstatusoutput() function, commands module, 332
gettarinfo() method, of TarFile objects, 321
gettempdir() function, tempfile module, 323
gettempprefix() function, tempfile module, 323
gettext module, 587
gettimeout() method, of socket objects, 482
getting help, help() function, 24
getting the current working directory, 379
gettrace() function, sys module, 234
getType() method, of SAX attributes objects, 582
getuid() function, os module, 380
geturl() method, of urlopen objects, 515
_getvalue() method, of BaseProxy objects, 433
getValue() method, of SAX attributes objects, 582
getvalue() method
of BytesIO objects, 352
of FieldStorage objects, 535
of StringIO objects, 354
getValueByQName() method, of SAX attributes objects, 582
getwch() function, msvcrt module, 372
getwche() function, msvcrt module, 372
getweakrefcount() function, weakref module, 241
getweakrefs() function, weakref module, 241
getwindowsversion() function, sys module, 234
gi_* attributes, of generator objects, 53
gid attribute, of TarInfo objects, 321
glob module, 317
glob() function, glob module, 317
global interpreter lock, 414, 444
and multiprocessing module, 444
releasing in extensions, 607
and modules, 143
global variables, 96
and eval(), 115
and modules, 146
difference from C and Fortran, 146
modifying in a function, 18
storage of in stack frames, 52
__globals__ attribute, of functions, 48, 99
globals() function, 205
gmtime() function, time module, 406
gname attribute, of TarInfo objects, 321
goto statement, lack of, 84
gray-bearded hacker, 622
greater than operator >, 66
greater than or equal to operator >=, 66
green threads, 446
greenlets, 446
group() method, of MatchObject objects, 285
groupby() function, itertools module, 271
groupdict() method, of MatchObject objects, 286
groupindex attribute, of Regex objects, 284
groups() method, of MatchObject objects, 285
grp module, 586
gt() function, operator module, 274
__gt__() method, 56
guess_all_extensions() function, mimetypes module, 567
guess_extension() function, mimetypes module, 567
guess_type() function, mimetypes module, 566
GUI programming, use of partial function evaluation, 268
GUIs, and network programming, 467
gzip module, 317
GzipFile() function, gzip module, 317
-h command line option, 173
h(elp) debugger command, pdb module, 188
handle() function, cgitb module, 539
handle() method, of BaseRequestHandler objects, 490
handle_accept() method, of dispatcher objects, 455
handle_charref() method, of HTMLParser objects, 561
handle_close() method, of dispatcher objects, 455
handle_comment() method, of HTMLParser objects, 561
handle_connect() method, of dispatcher objects, 455
handle_data() method, of HTMLParser objects, 561
handle_decl() method, of HTMLParser objects, 561
handle_endtag() method, of HTMLParser objects, 562
handle_entityref() method, of HTMLParser objects, 562
handle_error() method
of SocketServer class, 493
of dispatcher objects, 455
handle_expt() method, of dispatcher objects, 456
handle_pi() method, of HTMLParser objects, 562
handle_read() method, of dispatcher objects, 456
handle_startendtag() method, of HTMLParser objects, 562
handle_starttag() method, of HTMLParser objects, 562
handle_timeout() method, of SocketServer class, 493
handle_write() method, of dispatcher objects, 456
has_data() method, of Request objects, 517
has_header() method
of Request objects, 517
of Sniffer objects, 550
has_ipv6 variable, socket module, 475
has_key() method, of dicts, 45
has_option() method, of ConfigParser objects, 333
has_section() method, of ConfigParser objects, 333
hasattr() function, 205
and private attributes, 128
hasAttribute() method, of DOM Element objects, 572
hasAttributeNS() method, of DOM Element objects, 572
hasAttributes() method, of DOM Node objects, 571
hasChildNodes() method, of DOM Node objects, 571
hash table based databases, 310
hash() function, 205
__hash__() method, 56
Hashable abstract base class, 265
hashlib module, 559
example of, 425
header_offset attribute, of ZipInfo objects, 327
headers attribute
of BaseHTTPRequestHandler objects, 509
of FieldStorage objects, 535
heap, 269
heapify() function, heapq module, 269
heapmin() function, msvcrt module, 372
heappop() function, heapq module, 269
heappush() function, heapq module, 269
heappushpop() function, heapq module, 270
heapq module, 269
heapreplace() function, heapq module, 270
hello world program, 5
bizarre output with decorators, 113
herror exception, socket module, 485
future_builtins module, 217
hex() method, of floating point, 39
hexadecimal
creating strings from integers, 77
integer literals, 27
hexdigest() method
of digest objects, 559
of hmac objects, 560
hexdigits variable, string module, 287
hexversion variable, sys module, 231
hiding attribute names from dir() function, 128
hierarchical locking, 442
hierarchical logging, logging module, 360
hierarchy of exceptions, 87-88
hierarchy of objects, 137
HIGHEST_PROTOCOL constant, pickle module, 172
HKEY_* constants, winreg module, 408
HMAC authentication, 559
hmac module, 559
hostname attribute
of urlparse objects, 520
of urlsplit objects, 521
hostname, obtaining for host machine, 474
hour attribute, of time objects, 338
HTML forms
example of, 531
uploading with urllib package, 515
HTML parsing, 561
html.parser module, 561
HTMLParser class, html.parser module, 561
HTMLParser module, see html.parser, 561
HTMLParserError exception, html.parser module, 562
htonl() function, socket module, 475
htons() function, socket module, 475
HTTP cookies, 511
HTTP protocol
description of, 500
request methods, 501
response codes, 501
HTTP server
custom handling of requests, 510
example with asynchat module, 453
example with asyncore module, 457
example with coroutines, 466
example with firewall, 507
standalone example, 508
uploading files in POST request, 505
http package, 500
http.client module, 502
http.cookiejar module, 513
http.cookies module, 511
http.server module, 506
HTTPBasicAuthHandler class, urllib.request module, 518-519
HTTPConnection() function, http.client module, 502
HTTPCookieProcessor class, urllib.request module, 518-519
HTTPDefaultErrorHandler class, urllib.request module, 518
HTTPDigestAuthHandler class, urllib.request module, 518-519
HTTPError exception, urllib.error module, 523
HTTPException exception, http.client module, 504
HTTPHandler class
logging module, 362
urllib.request module, 518
httplib module, see http.client, 502
HTTPRedirectHandler class, urllib.request module, 518
HTTPResponse objects, http.client module, 504
HTTPSConnection() function, http.client module, 502
HTTPServer class, http.server module, 506
HTTPSHandler class, urllib.request module, 518
hypot() function, math module, 251
-i command line option, 173-174
I/O buffering, and generators, 165
I/O multiplexing, 459
__iadd__() method, 61
__iand__() method, 61
IBM General Decimal Arithmetic Standard, 243
ident attribute, of Thread objects, 436
identifiers, 26
and first-class data, 36
case sensitivity, 26
reserved words, 26
usage of underscores, 26
use of Unicode in Python 3, 622
identity comparison of objects, 34
identity of objects, 33
identity operator is, 78
__idiv__() method, 61
__idivmod__() method, 61
IDLE, 5-6
and standard I/O streams, 162
IEEE 754, 243
and __debug__ variable, 91
ifilter() function, itertools module, 271
ifilterfalse() function, itertools module, 271
__ifloordiv__() method, 61
iglob() function, glob module, 317
ignorableWhitespace() method, of ContentHandler objects, 581
ignore debugger command, pdb module, 188
‘ignore’ error handling, Unicode encoding, 166
ignore_environment attribute, of sys.flags, 230
ignore_pattern() function, shutil module, 318
ignore_zeros attribute, of TarFile objects, 321
ignored NameError exception in __del__, 179
ignoring exceptions, 85
__ilshift__() method, 61
imag attribute
of complex numbers, 39
of floating point, 39
imap() function, itertools module, 272
imap() method, of Pool objects, 424
imap_unordered() method, of Pool objects, 424
imaplib module, 587
imghdr module, 588
immutability, of tuples, 14
immutable types, inheriting from, 55
immutable, definition of, 33
__imod__() method, 61
implicit type conversion, lack of, 62
import statement, 13, 23-24, 50, 143-144
Python 3, 151
absolute imports in packages, 151
and main program, 146
and sys.modules, 144
and sys.path variable, 147
as qualifier, 144
case sensitivity, 148
compilation of .pyc files, 148
execution of modules, 143
module search path, 147
multiple modules, 144
one-time execution of modules, 144
packages, 150
placement within a program, 144
relative package imports, 150-151
scoping rules of loaded code, 145
types of modules, 148
ImportError exception, 87, 148, 214
importing selected symbols from a module, 145
ImproperConnectionState exception, http.client module, 504
__imul__() method, 61
in operator, 9
and __contains__ method, 58
and checking for substrings, 69
in-place assignment operators, 75
in-place file updates, 159
in-place mathematical operators, 61
in-place modification
of lists, 40
of sets, 47
in_dll() method, of ctypes type objects, 616
INADDR_* constants, socket module, 478
IncompleteRead exception, http.client module, 504
IncrementalDecoder class, codecs module, 279
incrementaldecoder() method, of CodecInfo objects, 279
IncrementalEncoder class, codecs module, 278
incrementalencoder() method, of CodecInfo objects, 278
and documentation strings, 30
and line continuation character , 9
and tabs, 26
preferred style, 8
putting statements on the same line, 25
IndentationError exception, 87, 214
index() method
of array objects, 260
of lists, 40-41
IndexError exception, 69, 87, 214
on lists, 12
on sequences, 68
on strings, 11
on tuples, 14
indexing, 0-based, 11
indexOf() function, operator module, 274
indices() method, of slices, 54
inet_aton() function, socket module, 475
inet_ntoa() function, socket module, 476
inet_ntop() function, socket module, 476
inet_pton() function, socket module, 476
inexact representation of floating point, 12
Inf variable, decimal module, 248
Inf
decimal module, 244
infinity, 213
info() method
of Logger objects, 357
of urlopen objects, 515
infolist() method, of ZipFile objects, 326
__mro__ attribute of classes, 121
abstract base classes, 137
attribute binding, 119
calling methods in superclasses, 120
from built-in types, 22
from immutable types, 55
initialization of superclasses, 120
interaction with__slots__, 133
internal optimization of, 233
isinstance() function, 34
issubclass() function, 135
metaclasses, 139
method resolution order, 121
multiple inheritance, 121
preventing redefinition of methods, 128
private methods, 128
use with exceptions, 88
.ini files
configuring logging with, 368
reading from Python, 332
init() function, mimetypes module, 567
and exceptions, 88
and inheritance, 120
and instance creation, 129
and metaclasses, 139
and pickle, 228
defining multiple instance creation methods, 123
__init__.py files in packages, 149
Python 3, 11
insert() method
of Element objects, 577
of array objects, 260
insertBefore() method, of DOM Node objects, 571
inserting items into a dictionary, 16
inserting items into a list, 41
insort() function, bisect module, 261
insort_left() function, bisect module, 261
insort_right() function, bisect module, 261
inspect attribute, of sys.flags, 230
inspect module, 222
inspecting objects, with dir(), 63
install command, of setup.py files, 154
install_opener() function, urllib.request module, 518
installation of third-party packages, 154
in user directory, 154
installing a package, 153
__instancecheck__() method, 57, 136
instances, 117
as callable, 50
attribute assignment, 131
attribute deletion, 131
definition of, 33
pickling of, 228
type of, 50
instantiation of abstract base class, 137
int type, 38
int() function, 11, 62, 76, 206
__int__() method, 61-62
and type coercion, 134
integer division, Python 3, 633
integers, 27
2’s complement representation, 66
as dictionary key, 16
automatic promotion to long, 27
conversion to longs, 38
creating hexadecimal strings, 77
creating random, 254
overflow behavior, 66
range of, 38
specifying as hex, octal, or binary, 27
Integral abstract base class, 253
IntegrityError exception, database API, 302
interactive attribute, of sys.flags, 230
and blank lines, 26
interactive terminal, 174
InterfaceError exception, database API, 302
internal_attr attribute, of ZipInfo objects, 327
InternalError exception, database API, 302
international characters
and string comparison, 70
in source code, 31
interpolation, of values in strings, 72
interpreter, 5
interpreter command line options, 173
interpreter environment variables, 174
interpreter prompts, 175
interpreter, -t and -tt options, 26
interprocess communication (IPC), 413
interrupt() method, of Connection objects, 306
intersection operator &, of sets, 15
intersection() method, of sets, 46
intersection_update() method, of sets, 47
interval timer, 399
introspection of objects, 222
inv() function, operator module, 273
InvalidURL exception, http.client module, 504
invert() function, operator module, 274
__invert__() method, 61
io module, 349
Python 3, 631
problems associated with, 354
IOBase abstract base class, 354
IOBase class, io module, 349
ioctl() function, fcntl module, 348
ioctl() method, of socket objects, 482
__ior__() method, 61
IP_* socket options, socket module, 480
__ipow__() method, 61
IPPROTO_* constants, socket module, 476
IPv4 protocol, 470
address format, 471
IPv6 protocol, 470
address format, 471
IPV6_* socket options, socket module, 480-481
IronPython, 5
example of, 620
__irshift__() method, 61
is operator, object identity, 34, 78
is_() function, operator module, 274
is_alive() method
of Process objects, 416
of Thread objects, 436
is_multipart() method, of Message objects, 554
is_not() function, operator module, 274
is_set() method, of Event objects, 440
is_tarfile() function, tarfile module, 319
is_unverifiable() method, of Request objects, 517
is_zipfile() function, zipfile module, 325
isabs() function, os.path module, 397
isabstract() function, inspect module, 224
isAlive() method, of Thread objects, 436
isalnum() method, of strings, 41, 43
isalpha() method, of strings, 43
isatty() function, os module, 383
isatty() method
of IOBase objects, 349
of files, 160
isblk() method, of TarInfo objects, 321
isbuiltin() function, inspect module, 224
ischr() method, of TarInfo objects, 321
isclass() function, inspect module, 224
iscode() function, inspect module, 225
isDaemon() method, of Thread objects, 437
isdatadescriptor() function, inspect module, 225
isdev() method, of TarInfo objects, 321
isdigit() method, of strings, 43
isdir() function, os.path module, 397
isdir() method, of TarInfo objects, 321
isdisjoint() method, of sets, 46
iselement() function, xml.etree.ElementTree module, 578
isenabled() function, gc module, 221
isEnabledFor() method, of Logger objects, 359
isfifo() method, of TarInfo objects, 321
isfile() function, os.path module, 397
isfile() method, of TarInfo objects, 321
isframe() function, inspect module, 225
isfunction() function, inspect module, 225
isgenerator() function, inspect module, 225
isgeneratorfunction() function, inspect module, 225
isinf() function, math module, 252
isinstance() function, 34, 37, 135, 206-207
and inheritance, 134
and proxy objects, 135
redefining behavior of, 136
islice() function, itertools module, 272
islink() function, os.path module, 397
islnk() method, of TarInfo objects, 321
islower() method, of strings, 43
ismethod() function, inspect module, 225
ismethoddescriptor() function, inspect module, 225
ismodule() function, inspect module, 225
ismount() function, os.path module, 397
isnan() function, math module, 252
iso-8859-1 encoding, description of, 169
isocalendar() method, of date objects, 337
isoformat() method
of date objects, 337
of time objects, 338
isoweekday() method, of date objects, 337
isreg() method, of TarInfo objects, 321
isReservedKey() method, of Morsel objects, 512
isroutine() function, inspect module, 225
isSameNode() method, of DOM Node objects, 571
isspace() method, of strings, 43
issubclass() function, 135, 206
redefining behavior of, 136
issubset() method, of sets, 46
issuperset() method, of sets, 46
issym() method, of TarInfo objects, 322
istitle() method, of strings, 43
istraceback() function, inspect module, 225
__isub__() method, 61
isupper() method, of strings, 41, 43
itemgetter() function, operator module, 275
items() method
of ConfigParser objects, 333
of Element objects, 577
of Message objects, 552
of dicts, 45
of dicts in Python 3, 632
itemsize attribute, of array objects, 259
ItemsView abstract base class, 266
iter() function, 206
Iterable abstract base class, 265
breaking out of a loop, 83
iteration variable, 82
over dictionary keys, 17
over dictionary values, 45
over multiple sequences, 83
portable function for next() operation, 207
protocol change in Python 3, 633
scope of iteration variable, 82
supported objects, 17
unpacking of tuples, 82
Iterator abstract base class, 265
iterators, use in Python 3, 632
iterdecode() function, codecs module, 279
iterdump() method, of Connection objects, 306
iterencode() function, codecs module, 279
iterencode() method, of JSONEncoder objects, 566
iterkeyrefs() method, of WeakKeyDictionary objects, 241
iterparse() function, xml.etree.ElementTree module, 578
itervaluerefs() method, of WeakValueDictionary objects, 241
__itruediv__() method, 61
__ixor__() method, 61
izip() function, itertools module, 83, 212, 272
izip_longest() function, itertools module, 272
J character, on complex number literals, 27
j(ump) debugger command, pdb module, 188
Java, 620
difference in class system, 119
Javascript, pop-up window example, 531
join() function, os.path module, 397
join() method
of JoinableQueue objects, 419
of Pool objects, 424
of Process objects, 416
of Queue objects, 445
of Thread objects, 436
of strings, 43
join_thread() method, of Queue objects, 418
JoinableQueue() function, multiprocessing module, 419
js_output() method
of Morsel objects, 512
of SimpleCookie objects, 512
JSON (JavaScript Object Notation), 563
json module, 563
difference from pickle and marshal, 565
JSONDecoder class, json module, 565
JSONEncoder class, json module, 566
jumpahead() function, random module, 254
Jython, 5
example of, 620
kbhit() function, msvcrt module, 373
key attribute, of Morsel objects, 512
key index operator [], 44
of dicts, 16
key keyword argument, to sort(), 40
KEY_* constants, winreg module, 410
keyboard interrupts, 162
KeyboardInterrupt class, 214
KeyboardInterrupt exception, 87-88, 162
KeyError exception, 44, 87, 214
keyrefs() method, of WeakKeyDictionary objects, 241
keys() method
of Element objects, 577
of Message objects, 552
of dicts, 45
of dicts in Python 3, 632
keys
acceptable types for dictionaries, 16
of dicts, 44
KeysView abstract base class, 266
mixing with positional arguments, 94
keyword module, 585
keyword-only arguments, Python 3, 625
keywords attribute, of partial objects, 268
kill() function, os module, 392
kill() method, of Popen objects, 403
killpg() function, os module, 392
kqueue, BSD, 460
18.188.180.254