|
Index
[ Symbols ],
[ Numbers ],
[ A ],
[ B ],
[ C ],
[ D ],
[ E ],
[ F ],
[ G ],
[ H ],
[ I ],
[ J ],
[ K ],
[ L ],
[ M ],
[ N ],
[ O ],
[ P ],
[ Q ],
[ R ],
[ S ],
[ T ],
[ U ],
[ V ],
[ W ],
[ X ],
[ Y ],
[ Z ]
Symbols[ Top ]
& (ampersand), bitwise AND, 44
* (asterisk)
** (double asterisk)
raising to a power, 43
from statement, 120
multiplication, 43
regular expressions, 157
sequence repetition, 46
string formatting, 152
*? (asterisk-question mark), regular expressions, 157
@ (at sign), struct format strings, 195
\ (backslash)
directory paths, 21
Windows, 173
line continuation, 30
\n (newline)
string literals, 35
regular expressions, 157
string literals, 35
` (backtick), string conversion, 43
^ (caret)
bitwise XOR, 44
MULTILINE attribute, 161
regular expressions, 157, 159
: (colon)
compound statements, 33
dictionaries, 38
Unix directory paths, 20
, (comma)
dictionaries, 38
functions, 59
lists, 37
plain assignment statements, 42
tuples, 36
$ (dollar sign)
MULTILINE attribute, 161
regular expressions, 157
" (double quote), string literals, 35
= (equal sign)
comparisons, 44
struct format strings, 195
! (exclamation point)
comparisons, 44
pdb command, 384
struct format strings, 195
/ (forward slash), 43
// (double forward slash)
truncating division, 43
directory paths, 21
Unix/Windows, 173
division operator, 43
determining behavior of, 21
> (greater than sign)
>> (double greater than)
right shift, 43
comparisons, 44
struct format strings, 195
- (hyphen)
regular expressions, 159
string formatting, 152
subtraction, 43
unary minus, 43
< (less than sign)
<< (double less than)
left shift, 43
comparisons, 44
struct format strings, 195
% (percent sign)
HTML templates, 490
remainder, 43
string formatting, 151
. (period)
attributes, 40
attribute reference, 43
instance objects, 74
current directory designation, 173
DOTALL attribute, 161
regular expressions, 157
string formatting, 152
+ (plus sign)
addition, 43
DateTime instances, 256
DateTimeDelta instances, 258
regular expressions, 157
sequence concatenation, 46
string formatting, 152
unary plus, 43
+? (plus sign-question mark), regular expressions, 157
# (pound sign)
comments, 29
regular expressions, 161
string formatting, 152
? (question mark), regular expressions, 157
; (semicolon)
statement separators, 32
Windows directory paths, 20
' (single quote)
string literals, 35
~ (tilde), bitwise NOT, 43
_ (underscore)
class-private variables, 73
gettext module, 220
identifiers, 30, 119
interactive sessions, 22
module-private variables, 119
special methods, 70
| (vertical bar)
bitwise OR, 44
regular expressions, 157, 160
< > (angle brackets)
event names, 366
HTML comments, 483
{ } (curly braces)
dictionaries, 38
dictionary creation, 43
line continuation, 30
python command-line syntax, 20
( ) (parentheses)
class statements, 71
def statement, 59
function calls, 62
line continuation, 30
plain assignment statements, 42
regular expressions, 157
string formatting, 152
tuple creation, 43
[ ] (square brackets)
indexing, 43
item indexes, 40
line continuation, 30
list creation, 43
lists, 37
plain assignment statements, 42
python command-line syntax, 20
regular expressions, 157, 159
slicing, 43
Numbers[ Top ]
4Suite, 494
A[ Top ]
abs function (built-in), 130
abs method (operator module), 299
_ _abs_ _ special method, 97
absdate attribute (DateTime class), 256
absdays attribute (DateTime class), 256
abspath function (os.path module), 177
abstime attribute (DateTime class), 256
AbstractFormatter class (formatter module), 486
AbstractWriter class (formatter module), 486
absvalues method
DateTime class, 254
DateTimeDelta class, 258
accept method (socket object), 433
Access database, 243
access function (os module), 174
accumulate attribute (ufunc object), 324
acos function
cmath module, 297
math module, 297
acosh function
cmath module, 297
math module, 297
acquire method
Condition class, 282
lock object, 277
Semaphore object, 284
Active Server Pages (ASP), 466
ActivePython, 17
ActiveScripting extension, 466
ActiveState
Python Cookbook, 10
Python IDEs offered by, 23
actual method (Font object), 354
add method
Menu object, 344
operator module, 299
Stats object, 398
_ _add_ _ special method, 97, 556
add_cascade method (Menu object), 344
add_checkbutton method (Menu object), 344
add_command method (Menu object), 344
add_data method (Request object), 414
add_header method
Message object, 473
Request object, 414
add_password method (HTTPPasswordMgrWithDefaultRealm object), 416
add_payload method (Message object), 473
add_radiobutton method (Menu object), 344
add_separator method (Menu object), 344
addstr method (Window object), 209
after method (Widget object), 369
after_cancel method (Widget object), 369
after_idle method (Widget object), 369
alias command (pdb module), 385
allclose function (Numeric module), 316
Alternative Readline for Windows, 206
Amiga, installing Python, 17
ampersand (&), bitwise AND, 44
anchor_bgn method (HTMLParser object), 485
anchor_end method (HTMLParser object), 485
anchorlist attribute (HTMLParser object), 485
and_ method (operator module), 299
_ _and_ _ special method, 98
angle brackets (< >)
event names, 366
HTML comments, 483
anydbm module, 231
anygui toolkit, 328
Apache servers
FastCGI for, 466
installing Python CGI scripts, 461
PyApache/mod_python for, 467
Webware/mod_webkit for, 467
append method (list object), 49
appendChild method (Node object), 510
Apple Macintosh (see Macintosh)
applets, Jython, 5, 559
apply function (built-in), 130
April attribute (mx.DateTime module), 259
arange function (Numeric module), 310
Archaeopterix, Python IDE offered by, 23
archive files, packages distributed as, 124
argmax function (Numeric module), 316
argmin function (Numeric module), 316
args attribute (exception object), 109
args command (pdb module), 385
argsort function (Numeric module), 316
arguments, 59
calling functions, 62-64
argv attribute (sys module), 137
arithmetic progression
retrieving list of integers in, 135
returning sequence with items in, 137
ArithmeticError exception, 109
ARPA module, 259
array function
array module, 302
jarray module, 553
Numeric module, 309
array module, 301-303
array function, 302
Numeric module and, 302
type codes for, 302
array object (Numeric module), 304-322
astype method, 312
broadcasting, 315
byteswap method, 303
byteswapped method, 312
comparing, 309
copy method, 312
flat method, 312
fromfile method, 303
fromlist method, 303
fromstring method, 303
imag method, 312
imaginary method, 312
indexing, 306
iscontiguous method, 313
itemsize method, 313
masked, 327
operations on, 314
real method, 312
savespace method, 313
shape attribute, 305
shape method, 313
slicing, 307-309
spacesaver method, 313
storing, 306
tofile method, 303
tolist method, 303, 313
tostring method, 303, 314
type codes, 304
typecode method, 314
array type (array module), 301
array2string function (Numeric module), 316
arrayrange function (Numeric module), 310
arrays, 296
article method (NNTP object), 424
ASCII/ISO integer code, 135
ascii_letters attribute (string module), 149
ascii_lowercase attribute (string module), 149
ascii_uppercase attribute (string module), 149
asctime function (time module), 246
asin function
cmath module, 297
math module, 297
asinh function
cmath module, 297
math module, 297
ASP (Active Server Pages), 466
assert_ method (TestCase object), 378
assert statement, 115
assertEqual method (TestCase object), 379
AssertionError class (built-in)
assert statement, 115
AssertionError exception, 110
assertNotEqual method (TestCase object), 379
assertRaises method (TestCase object), 379
assignment statements, 33, 40-42, 141
to array slices, 308
augmented, 42
plain, 41
as_string method (Message object), 473
asterisk (*), 46
double asterisk (**)
raising to a power, 43
from statement, 120
multiplication, 43
regular expressions, 157
string formatting, 152
asterisk-question mark (*?), regular expressions, 157
astype method (array object), 312
async_chat class (asynchat module), 448
collect_incoming_data method, 448
found_terminator method, 448
push method, 448
set_terminator method, 449
asynchat module, 448
performance characteristics, 468
asynchronous programming (see sockets, event-driven programs)
asyncore module, 446
dispatcher class, 446
loop function, 446
performance characteristics, 468
at sign (@), struct format strings, 195
atan/atan2 functions
cmath module, 297
math module, 297
atanh function
cmath module, 297
math module, 297
atexit module, 273
register function, 274
atof function (locale module), 217
atoi function (locale module), 217
Attr class (minidom module), 504
ownerElement attribute, 504
specified attribute, 504
AttributeError exception, 76, 110
array object, 306
AttributeList class (minidom module), 502
attributes, 40, 61
binding, 136
class attributes, 71
instance attributes, 74
of class objects, 71
DBAPI-compliant modules, 239
deleting, 131
"deleting" class attributes, 81
documentation strings, 61
of file object, 189-191
of module object, 117
overriding, 80
path-string (os module), 173
references, 75
Tkinter module, 366
ufunc object, 323
unbinding
class attributes, 71
instance attributes, 74
attributes attribute (Node object), 503
Attributes object (xml.sax package)
getNameByQName method, 498
getQNameByName method, 498
getQNames method, 498
getValueByQName method, 498
augmented assignment statements, 42
August attribute (mx.DateTime module), 259
authentication
SMTP servers, 418
URL access to network protocols, 415
author argument (distutils setup function), 561
author_email argument (distutils setup function), 562
average function (Numeric module), 317
B[ Top ]
backslash (\)
directory paths, 21
Windows, 173
line continuation, 30
regular expressions, 157
string literals, 35
backtick (`), string conversion, 43
backward compatibility, 7
exception objects, strings as, 109
base64 module, 469
decode function, 469
decodestring function, 470
encode function, 470
encodestring function, 470
BaseHandler class, 415
BaseHTTPRequestHandler class, 440
BaseHTTPServer module, 440
web server implementation, 468
basename function (os.path module), 177
BaseRequestHandler class (SocketServer module), 439
client_address method, 439
handle method, 439
request method, 439
server method, 439
Bastion class (Bastion module), 266
Bastion module, 262
Bastion class, 266
bbox method (Canvas object), 357
benchmarking, 371, 393
Berkeley Database library (see BSD DB)
binaries
downloading, 17
installing from, 16
third-party installers for various platforms, 17
Binary class (xmlrpclib module), 429
binary data, encoding as text, 469-471
base64 module, 469
quopri module, 470
uu module, 471
binary file mode, 188
binary function (xmlrpclib module), 429
bind method
socket object, 434
Widget object, 368
bind_all method (Widget object), 368
binding, references, 39
bisect function (bisect module), 143
bisect module
bisect function, 143
insort function, 143
BitmapImage class, 335
BlackAdder IDE, 23
blank lines, 29
blitz function (Numeric module), 545
Boa Constructor IDE, 23
body method (NNTP object), 424
bool function (built-in), 39, 130
Boolean class (xmlrpclib module), 429
Boolean context, 52
boolean function (xmlrpclib module), 429
Boolean values, 39
Boost Python Library, 545
bound methods, 77-79
(see also methods)
braces (see curly braces)
brackets (see square brackets)
break command (pdb module), 385
break statement, 57
browsers, 481
BSD DB (Berkeley Database library), 232, 234
bsddb module, 234-236
btopen function, 234
close method, 234
first function, 235
has_key function, 235
hasopen function, 234
keys function, 235
last method, 235
next method, 235
previous function, 235
rnopen function, 234
set_location function, 235
btopen function (bsddb module), 234
buffer function (built-in), 130
buffering
cmd.py and, 291
writing buffer out to OS, 189
build_opener function (urllib2 module), 413
_ _builtin_ _ class, 556
built-in exception classes
ArithmeticError, 109
AssertionError, 110
AttributeError, 110
EnvironmentError, 109
Exception, 109
FloatingPointError, 110
ImportError, 110
IndentationError, 110
IndexError, 110
IOError, 110
KeyboardInterrupt, 110
KeyError, 110
LookupError, 109
MemoryError, 110
NameError, 110
NotImplementedError, 110
OSError, 110
OverflowError, 110
StandardError, 109
SyntaxError, 110
SystemError, 111
TypeError, 111
UnboundLocalError, 111
UnicodeError, 111
ValueError, 111
WindowsError, 111
ZeroDivisionError, 111
built-in functions, 129-137
abs, 130
apply, 130
bool, 39, 130
buffer, 130
callable, 130
chr, 130
cmp, 49, 131
coerce, 131
compile, 131
exec statement and, 261
delattr, 131
dir, 131
divmod, 45, 131
encode, 155
eval, 131, 205
execfile, 132
filter, 132
getattr, 132
globals, 132
hasattr, 132
hash, 37, 132
hex, 133
id, 133
_ _import_ _, 120, 129
input, 133, 205
safer variant of, 265
isinstance, 33, 73, 133
issubclass, 70, 133
iter, 55, 133
len, 46, 49, 134
locals, 134
map, 134
max, 46, 135
min, 46, 135
oct, 135
open
creating file object, 187-189
restricted execution, 264
ord, 135
pow, 45, 135
range, 55, 135
raw_input, 135, 205
reduce, 135
reload, 122, 136
repr, 136
round, 136
setattr, 136
slice, 136
unichr, 137
vars, 137
xrange, 55, 137
zip, 137
_ _builtin_ _ module, 129
_ _builtins_ _ attribute, 118
(see also built-in functions)
built-in modules, 118
_ _import_ _ function, 123
loading, 121
built-in types, 126-129
classmethod, 83, 127
complex, 33, 127
dict, 37, 127
file (open), 127, 187
float, 33, 127
int, 33, 127
list, 37, 128
long, 33, 128
object, 81, 128
property, 85, 128
staticmethod, 82, 128
str, 47, 128, 145-149
date/time string conversions, 252
super, 89, 128
tuple, 48, 128
type, 100, 129, 268
unicode, 47, 129, 145-149, 154
built-in variables
_ _debug_ _, 115
_ _builtins_ _ attribute (built-in module), 118
Button class (Tkinter module), 336
flash method, 336
invoke method, 336
byteswap method (array object), 303
byteswapped method (array object), 312
C[ Top ]
C compiler, ISO-compliant, installing Python and, 12
C library, 327
time module and, 245
C programming language, CPython and, 515
C++ programming language, extending Python with, 545
calcsize function (struct module), 196
calculator, 22
calendar function (calendar module), 250
calendar module, 250-252
calendar function, 250
firstweekday function, 250
isleap function, 251
leapdays function, 251
month function, 251
monthcalendar function, 251
monthrange function, 251
prcal function, 251
prmonth function, 251
setfirstweekday function, 251
timegm function, 251
weekday function, 252
calibrate method (Profile object), 397
_ _call_ _ method
PyObject object, 556
special method, 91
call stack
_getframe function, 139
retrieving limit on depth of, 139
setting limit on depth of, 140
unwinding on exceptions, 107
callable function (built-in), 130
callable types, 38
callLater method (reactor object), 451
cancel method (scheduler object), 249
cancelCallLater method (reactor object), 451
Canvas class (Tkinter module), 356
bbox method, 357
coords method, 357
create_line method, 358
create_polygon method, 359
create_rectangle method, 359
create_text method, 360
delete method, 357
gettags method, 357
itemcget method, 357
itemconfig method, 357
tag_bind method, 357
tag_unbind method, 358
canvas widget, 356-360
lines, 358
polygons, 359
rectangles, 359
text, 360
capitalize method (string object), 145
caret (^)
bitwise XOR, 44
MULTILINE attribute, 161
regular expressions, 157, 159
case sensitivity, 30
filesystems, 179
regular expressions, 161
strings, 145, 147
Windows os.environ keys, 288
ceil function
cmath module, 297
math module, 297
center method (string object), 145
.cfg extension, customizing package installation, 125
cget method
Font object, 354
Widget object, 333
CGI (Common Gateway Interface), 454
(see also CGI scripting)
cgi module, 455-458
escape function, 455
FieldStorage class, 456
CGI scripting, 442, 454-466
Content-Type header, 458
cookies, 462-466
error messages, 459
cgitb module, 460
HTML forms submission, 455
output, 458
scripts
performance characteristics, 466
Python, installing, 461
CGIHTTPServer module, 440, 442
cgitb module, 460
enable function, 460
handle function, 460
char attribute (Event object), 366
characters method (ContentHandler object), 497
chdir function (os module), 174
checkbox widgets, 336
Checkbutton class (Tkinter module), 336
deselect method, 337
flash method, 337
invoke method, 337
select method, 337
toggle method, 337
checkcache function (linecache module), 194
Cheetah package, 490-493
templating language, 491
Cheetah.Template module, 492
Template class, 492
child widgets, 341
childNodes attribute (Node object), 503
chmod function (os module), 174
choice method (Random object), 300
choose function (Numeric module), 317
chr function (built-in), 130
circular imports, 122
class body, 71-73
attributes, 71
class-private variables, 73
docstrings, 73
function definitions in, 72
class methods, 83
class object
_ _bases_ _ attribute, 72
_ _dict_ _ attribute, 72
_ _doc_ _ attribute, 73
_ _name_ _ attribute, 71
class statement, 70
classes, 33
how metaclasses create, 101
metaclasses of, how Python determines, 100
classes, classic, 70-81
attribute references, 75
bound methods, 76-79
class body, 71-73
class statement, 70
inheritance, 79-81
instances of, 73-75
unbound methods, 76-79
classes, new-style, 81-90
built-in object type, 81
class-level methods, 82
inheritance, 88-90
cooperative superclass method calling, 89
method resolution order, 88
instances of, 84-88
per-instance methods, 87
classic classes (see classes, classic)
Classic Python (see CPython)
class-level methods, 82
class, 83
static, 82
classmethod type (built-in), 83, 127
class-private variables, 73
clauses, 33, 52
clear command (pdb module), 385
clear method
dictionary object, 50
Event object, 283
clearcache function (linecache module), 195
client_address method (BaseRequestHandler object), 439
clients, 407
clip function (Numeric module), 317
clock function (time module), 246
close function (os module), 185
close method
bsddb module, 234
Connection object, 240
Cursor object, 241
file object, 189
fileinput module, 193
HTMLParser object, 488
HTTPConnection object, 419
mmap object, 293
sgmllib module, 482
socket object, 434
Telnet object, 427
URL file-like object, 411
XMLReader object, 499
zipfile module, 201
closed attribute (file object), 189
clrtobot method (Window object), 209
clrtoeot method (Window object), 209
cmath module, 297-299
acos function, 297
acosh function, 297
asin function, 297
asinh function, 297
atan/atan2 functions, 297
atanh function, 297
ceil function, 297
cos function, 297
cosh function, 297
exp function, 298
fabs function, 298
floor function, 298
fmod function, 298
frexp function, 298
hypot function, 298
ldexp function, 298
log function, 298
log10 function, 298
modf function, 298
pow function, 298
sin function, 299
sinh function, 299
sqrt function, 299
tan function, 299
Cmd class (cmd module), 212
cmd module, 212-215
attributes, 214
Cmd class, 212
cmdloop function, 212
default function, 213
do_help function, 213
emptyline function, 213
identchars attribute, 214
intro attribute, 214
lastcmd attribute, 214
methods, 212-214
onecmd function, 213
postcmd function, 214
postloop function, 214
precmd function, 214
preloop function, 214
prompt attribute, 215
use_rawinput attribute, 215
cmdloop function (cmd module), 212
cmp function
built-in, 49, 131
filecmp module, 182
mx.DateTime module, 259
_ _cmp_ _ special method, 91
cmpfiles function (filecmp module), 182
co_argcount attribute (code object), 268
code object
co_argcount attribute, 268
co_varnames attribute, 268
exec statement and, 261
codecs, 154
codecs module, 155
EncodedFile function, 155
open function, 156
coded_value attribute (Morsel object), 464
coders-decoders (codecs), 154
CodeWarrier Pro 7 C compiler, 16
coerce function (built-in), 131
_ _coerce_ _ special method, 98
collect function (gc module), 269
collect_incoming_data method (async_chat object), 448
colon (:)
compound statements, 33
dictionaries, 38
Unix directory paths, 20
COM, 466
date epoch, 253
extending Python with, 545
COMDate method (DateTime class), 255
comma (,)
dictionaries, 38
functions, 59
lists, 37
plain assignment statements, 42
tuples, 36
command attribute (HTTPServer object), 440
command-line options, parsing, 141
comment attribute (zipfile module), 200
comments, 29, 161
commit method (Connection object), 241
Common Gateway Interface (CGI), 454
commonprefix function (os.path module), 177
compare method (Text object), 353
comparing
arrays of numbers, 309
directory paths, 182
files, 182
numbers, 46, 91
compile function
built-in, 131
exec statement and, 261
re module, 156, 168
flags argument, 161
_ _complex_ _ special method, 98
complex type (built-in), 33, 127
compound statements, 33
compress function
Numeric module, 317
zlib module, 203
compression, 198-203
gzip module, 198
zipfile module, 200-203
zlib module, 203
compress_size attribute (zipfile module), 200
compress_type attribute (zipfile module), 200
concat method (operator module), 299
concatenate function (Numeric module), 318
concatenating
sequences, 46
strings, 147
Condition class (threading module), 279, 282
acquire method, 282
notify method, 282
notifyAll method, 282
release method, 282
wait method, 282
condition command (pdb module), 385
config method
Font object, 354
Widget object, 333
connect function (DBAPI-compliant modules), 240
connect method
FTP object, 421
SMTP object, 418
socket object, 432, 434
Connection object (DBAPI-compliant modules)
close method, 240
commit method, 241
cursor method, 241
rollback method, 241
connectionLost method (Protocol object), 452
connectionMade method (Protocol object), 452
console I/O, 208-212
Console module, 212
curses package, 208-211
msvcrt module, 211
WConio module, 212
Console module, 212
constructor function (copy_reg module), 229
constructor (see _ _init_ _ special method)
contact argument (distutils setup function), 562
contact_email argument (distutils setup function), 562
container methods
_ _contains_ _, 96
_ _delitem_ _, 96
_ _getitem_ _, 96
_ _iter_ _, 96
_ _len_ _, 97
_ _setitem_ _, 97
container widgets, 341-344
frames, 341
top-level windows, 341
containers, 329
returning number of items in, 134
slicing, 95
special methods for, 94-97
contains method (operator module), 299
_ _contains_ _ special method, 96
ContentHandler class (xml.sax package), 497
characters method, 497
endDocument method, 497
endElement method, 497
endElementNS method, 497
startDocument method, 497
startElement method, 498
startElementNS method, 498
continuation lines, 30
continue command (pdb module), 385
continue statement, 57
control flow statements, 51-58
break statement, 57
continue statement, 57
for statement, 54-57
iterators, 55
list comprehensions, 56
range/xrange functions, 55
if statements, 52
pass statement, 58
try statement, 58
while statements, 53
converting
integers to hexadecimal strings, 133
numbers, 127
to floating-point, 127
to integers, 127
numeric operators, 45
strings, 43, 127
date/time types, 252
to floating-point, 127
to Unicode, 154
time values, 248
convolve function (Numeric module), 318
Cookie module, 463
Morsel class, 463
SimpleCookie class, 463
SmartCookie class, 463
cookies, 462-466
Cooledit program, 24
Coordinated Universal Time (UTC), 245
coords method (Canvas object), 357
copy function
copy module, 142
shutil module, 183
copy method
array object, 312
dictionary object, 50
Font object, 354
copy module
copy function, 142
deepcopy function, 142
copy2 function (shutil module), 183
copyfile function (shutil module), 183
copyfileobj function (shutil module), 184
copying
deep copying, 142
file permission bits, 184
files, 183
types, 142
copymode function (shutil module), 184
copy_reg module
constructor function, 229
pickle function, 229
pickling customization with, 228
copystat function (shutil module), 184
copytree function (shutil module), 184
cos function
cmath module, 297
math module, 297
cosh function
cmath module, 297
math module, 297
count method
list object, 49
string object, 146
countOf method (operator module), 299
co_varnames attribute (code object), 268
cPickle module, 225-229
dump/dumps functions, 226
load/loads functions, 226
Pickler function, 227
pickling customization with copy_reg module, 228
Unpickler function, 227
.cpp files, 565
CPython (Classic Python), 5, 515
C-coded Python extensions
abstract layer functions, 528
arguments, 521
building/installing, 516
concrete layer functions, 533
creating Python values, 524
defining types, 538
exceptions, 526
functions, 518
module initialization, 518
overview, 516-518
reference counting, 520
CNRI Open Source GPL-Compatible License, 6
embedding, 546-549
installing extension modules, 546
Python initialization/finalization, 547
running Python code, 547-549
setting arguments, 546
extending
in other languages, 545
with Python C API, 515-545
installing, 12
reference counts, 269
CRC checksums (cyclic-redundancy check checksums), 203
createComment method (Document object), 509
createElement method (Document object), 509
create_line method (Canvas object), 358
create_polygon method (Canvas object), 359
create_rectangle method (Canvas object), 359
create_socket method (dispatcher object), 446
create_text method (Canvas object), 360
createTextNode method (Document object), 509
creating
dictionaries, 43
directory paths, 175
file object, 187-189
designating buffering, 188
sequential/nonsequential access, 189
specifying file mode, 187
iterators, 133
lists, 43
pipes, 186
prebuilt distributions with distutils, 567
tuples, 43
cross_correlate function (Numeric module), 318
cross-platform portability (see portability)
cross-platform programs, rich-text I/O functionality, 206
cStringIO function (cStringIO module), 197
cStringIO module, 197
ctime function (time module), 247
curdir attribute (os module), 173
curly braces ({ })
dictionaries, 38
dictionary creation, 43
line continuation, 30
python command-line syntax, 20
currentframe function (inspect module), 381
currentThread function (threading module), 279
curselection method (Listbox object), 338
curses package, 208-211
curses programming, 208
cursor method (Connection object), 241
Cursor object
close method, 241
DBAPI, 241
description attribute, 241
execute method, 242
executemany method, 242
fetchall method, 242
fetchmany method, 242
fetchone method, 242
rowcount attribute, 242
customization, 274
cwd method (FTP object), 421
CXX library, 545
cyclic garbage loops, 269
cyclic-redundancy check checksums (CRC checksums), 203
Cygwin, building Python for, 15
D[ Top ]
data attribute
UserDict module, 143
UserList module, 143
UserString module, 143
data types, 33-39
Boolean values, 39
callable, 38
C-coded, 538-546
dictionaries, 37
None, 38
numbers, 33
Python versions, 33
sequences, 34-37
lists, 37
strings, 35
tuples, 36
user-definable, 69-103
Database API (see DBAPI 2.0)
data_files argument (distutils setup function), 564
dataReceived method (Protocol object), 452
date attribute (DateTime class), 256
Date function
DBAPI-compliant modules, 239
mx.DateTime module, 253
DateFromTicks function
DBAPI-compliant modules, 239
mx.DateTime module, 253
date_time attribute (zipfile module), 200
DateTime class (mx.DateTime module), 252-254
absdate attribute, 256
absdays attribute, 256
abstime attribute, 256
absvalues method, 254
COMDate method, 255
date attribute, 256
day attribute, 256
day_of_week attribute, 256
day_of_year attribute, 256
dst attribute, 256
gmticks method, 255
gmtime method, 255
gmtoffset method, 255
hour attribute, 256
iso_week attribute, 256
localtime method, 255
minute attribute, 256
month attribute, 256
second attribute, 256
strftime method, 255
ticks method, 255
tuple method, 255
year attribute, 256
DateTime class (xmlrpclib module), 430
DateTime function (mx.DateTime module), 253
date/time values
compressed files, 200
computing moveable feast days, 259
converting, 248
current CPU time, retrieving, 246
directory paths, 177
internationalization and, 216
in ISO 8601 formats, 259
time-tuple, 245
(see also calendar module; time operations)
DateTimeDelta class (mx.DateTime module), 257
absvalues method, 258
attributes, 258
DateTimeDelta function, 257
DateTimeDeltaFrom function, 257
DateTimeDeltaFromSeconds function, 257
day attribute, 258
days attribute, 258
hour attribute, 258
hours attribute, 258
methods, 257
minute attributes, 258
minutes attribute, 258
second attribute, 258
seconds attribute, 258
strftime method, 258
TimeDelta function, 257
TimeDeltaFrom function, 257
TimeFromTicks function, 257
tuple method, 258
DateTimeDelta function (DateTimeDelta class), 257
DateTimeDeltaFrom function (DateTimeDelta class), 257
DateTimeDeltaFromSeconds function (DateTimeDelta class), 257
DateTimeFrom function (mx.DateTime module), 253
DateTimeFromAbsDays function (mx.DateTime module), 253
DateTimeFromCOMDays function (mx.DateTime module), 253
day attribute
DateTime class, 256
DateTimeDelta class, 258
Daylight Saving Time (DST), 245
day_of_week attribute (DateTime class), 256
day_of_year attribute (DateTime class), 256
days attribute (DateTimeDelta class), 258
DB2 module, 243
DBAPI 2.0 (Database API 2.0), 223, 237-244
-compliant modules, 239, 243
connect function, 240
connection object, 240
Cursor object, 241
Gadfly, 244
type-description attributes, 239
(see also bsddb module), 243
DBAPI 3.0, 237
dbhash module, 231
open function, 232
dbm library, 231
dbm module, 232
DBM modules, 230-236
anydbm module, 231
bsddb module, 234-236
dbm/gdbm/dbhash modules, 232
dumbdbm module, 232
whichdb module, 232
DCOracle2 module, 243
Debian GNU/Linux, installing Python, 17
_ _debug_ _ variable (built-in), 115
debugging, 115, 371, 380-391
CGI scripts, 442, 459
HTML, 486
in IDLE, 388
inspect module, 380-383
pdb module, 384-388
print statement and, 204
race conditions, 285
traceback module, 384
warnings module, 388-391
December attribute (mx.DateTime module), 259
decimal literals, 33, 34
decode function
base64 module, 469
quopri module, 470
Utils module, 478
uu module, 471
decodestring function
base64 module, 470
quopri module, 470
decompress function (zlib module), 203
deepcopy function (copy module), 142
def statement, 59, 71, 72
default function (cmd module), 213
default search path, designating, 173
define_macros argument (distutils Extension class), 566
defining
functions in class body, 72
metaclasses, 101
defpath attribute (os module), 173
deiconify method (Toplevel object), 342
_ _del_ _ special method, 91
del statements, 39, 42
dictionaries, 50
delattr function (built-in), 131
_ _delattr_ _ special method, 82, 92
delch method (Window object), 209
dele method (POP3 object), 417
delete method
Canvas object, 357
Entry object, 337
FTP object, 421
Listbox object, 338
Menu object, 345
Text object, 347
deleteln method (Window object), 209
deleting attributes, 131
delimiters, list of, 31
delitem method (operator module), 299
_ _delitem_ _ special method, 96
delslice method (operator module), 299
denial-of-service attacks (see security, denial-of-service attacks)
DeprecationWarning class, 389
descendants, 70
description argument (distutils setup function), 562
description attribute (Cursor object), 241
deselect method
Checkbutton object, 337
Radiobutton object, 339
destructor (see _ _del_ _ special method)
development environments, 22-24
text editors with Python support, 24
diagonal function (Numeric module), 318
_ _dict_ _ attribute
class object, 72
module object, 118
dict type (built-in), 37, 127
dictionaries, 37
dictionary items, 37
dictionary keys, 37
exec statement and, 260
indexing, 50
listing loaded module names, 139
methods, 50
operations on, 49
optimizing operations on, 396
representing current local namespace, 134
dictionary object (dict type)
clear method, 50
copy method, 50
get method, 50
has_key method, 50
items method, 50
iteritems method, 50
iterkeys method, 50
itervalues method, 50
keys method, 50
popitem method, 50
setdefault method, 50
update method, 50
values method, 50
DictionaryType attribute (types module), 268
DictType attribute (types module), 268
digits attribute (string module), 149
dir function (built-in), 131
dircmp function (filecmp module), 182
directory paths
absolute, retrieving name of, 178
base name of, retrieving, 177
comparing, 182
creating, 175
current working directory
returning path of, 175
setting, 174
distribution utilities, 561
information about, retrieving, 176
mount points, 178
normalized names, retrieving, 179
parent directory, 173
removing, 175, 184
renaming, 175
separator between lists of, 173
setting time on, 177
specifying when module loading, 139
symbolic links to, 178
dirname function (os.path module), 177
disable command (pdb module), 385
disable function (gc module), 269, 271
dispatcher class (asyncore module), 446
create_socket method, 446
handle_accept method, 446
handle_close method, 447
handle_connect method, 447
handle_read method, 447
handle_write method, 447
displayhook function (sys module), 138
disposition attribute (FieldStorage object), 457
disposition_options attribute (FieldStorage object), 457
distributed computing, 428-430
distribution root directory, 561
setup.py script, 561
distribution utilities (see distutils)
distributions, 560
root directory of, 561
distutils (distribution utilities), 124, 560-568
creating prebuilt distributions, 567
distribution contents, 563
distribution root directory, 560
distutils module, Extensions class, 565
distutils module, setup function, 561
distutils package, 125
MANIFEST files, 567
providing metadata about distribution, 561
setup.cfg file, 567
setup.py script, 561
div method (operator module), 299
_ _div_ _ special method, 97
division, 43
divmod function (built-in), 45, 131
_ _divmod_ _ special method, 98
.dll files, 515
DLLs (dynamic load libraries), 515
interoperability of Python release and debugging builds, 14
DNS (Domain Name System), 432
_ _doc_ _ attribute
class object, 73
module object, 119
docstrings, 61, 73, 119
doctest module, 373-376
doctype attribute (Document object), 505
Document class (minidom module), 505, 509
createComment method, 509
createElement method, 509
createTextNode method, 509
doctype attribute, 505
DocumentElement attribute, 505
getElementById method, 505
getElementsByTagName method, 505
getElementsByTagNameNS method, 505
methods, 509
Document Object Model (see DOM, parsing XML)
Document Type Definition (DTD), 496
documentation, 8
embedding/extending Python, 515
documentation strings (see docstrings)
documentElement attribute (Document object), 505
do_help function (cmd module), 213
dollar sign ($)
MULTILINE attribute, 161
regular expressions, 157
DOM (Document Object Model), parsing XML, 501-508
minidom module, 502-506
pulldom module, 507
xml.dom package, 502
(see also minidom module)
Domain Name System (DNS), 432
DOMEventStream class (pulldom module), 507
DOMException class (xml.dom package), 502
do_tag method
HTMLParser object, 485
sgmllib module, 482
DOTALL attribute (re module), 161
double quote ("), string literals, 35
down command (pdb module), 386
dst attribute (DateTime class), 256
DST (Daylight Saving Time), 245
DTD (Document Type Definition), 496
dumbdbm module, 231
open function, 232
DumbWriter class (formatter module), 487
dump_address_pair function (Utils module), 478
dump/dumps functions
marshal module, 224
pickle/cPickle modules, 226
dup/dup2 functions (os module), 185
dynamic execution, 260-262
dynamic load libraries (see DLLs)
E[ Top ]
EAFP (easier to ask forgiveness than permission), 112
Queue module and, 279
easier to ask forgiveness than permission (see EAFP)
echo servers
TCP, 435
UDP, 436
edit function, textpad module, 211
EditPythonPrefs icon (Macintosh), 20
eGenix GmbH, 252
Element class (minidom module), 505, 509
getAttribute method, 505
getAttributeNode method, 506
getAttributeNodeNS method, 506
getAttributeNS method, 506
getElementsByTagName method, 506
getElementsByTagNameNS method, 506
hasAttribute method, 506
hasAttributeNS method, 506
methods of, 509
removeAttribute method, 509
setAttribute method, 509
elif clause, 52
else clause, 52, 58
emacs program, 24
email package, 472-479
Encoders module, 477
functions, 472
Generator module, 476
Message module, 472-475
Utils module, 478
email protocols, 416-419
poplib module, 417
smtplib module, 418
email (see email package)
embedding/extending
CPython, 515-549
Jython, 550-559
Empty class (Queue module), 278
empty method
Queue object, 278
scheduler object, 249
emptyline function (cmd module), 213
enable command (pdb module), 386
enable function
cgitb module, 460
gc module, 270
encode function
base64 module, 470
built-in, 155
quopri module, 470
Utils module, 478
uu module, 471
encode method, string object, 146
encode_7or8bit function (Encoders module), 478
encode_base64 function (Encoders module), 477
EncodedFile function (codecs module), 155
encode_noop function (Encoders module), 477
encode_quopri function (Encoders module), 477
Encoders module, 477
encode_7or8bit function, 478
encode_base64 function, 477
encode_noop function, 477
encode_quopri function, 477
encodestring function
base64 module, 470
quopri module, 471
encoding binary data as text, 469-471
base64 module, 469
quopri module, 470
uu module, 471
encodings
codecs, 154
Latin-1, 487
network, 469-480
encodings package, 155
end method (match object), 167
endDocument method (ContentHandler object), 497
endElement method (ContentHandler object), 497
endElementNS method (ContentHandler object), 497
end_headers method (HTTPServer object), 440
endpos attribute (match object), 166
endswith method (string object), 146
end_tag method
HTMLParser object, 485
sgmllib module, 482
enter method (scheduler object), 250
enterabs method (scheduler object), 250
entity references, HTML, 483
entitydefs attribute (htmlentitydefs module), 487
Entry class (Tkinter module), 337
delete method, 337
get method, 337
insert method, 337
entryconfigure method (Menu object), 345
environ attribute (os module), 288
environment variables
name of, retrieving, 177
process environment, 287
Python interpreter and, 19
EnvironmentError exception, 109
epilogue attribute (Message object), 473
epoch, 245
_ _eq_ _ special method, 92
equal sign (=)
comparisons, 44
struct format strings, 195
erase method (Window object), 209
errno attribute (os module), 172
errno module, 172
error handling, 112-115
assert statement, 115
_ _debug_ _ variable, 115
error-checking strategies, 112
errors vs. special cases, 114
in large programs, 113
logging errors, 114
error messages
CGI scripting, 459
code numbers, 172
file printed to, 107
internationalization and, 216
stderr attribute (sys module), 204
traceback messages, 104
(see also warnings module)
escape function
cgi module, 455
re module, 168
saxutils module, 499
eval function (built-in), 131, 205
eval method (PythonInterpreter object), 555
Event class
threading module, 279, 283
Tkinter module, 366
Event object (threading module), 283
clear method, 283
isSet method, 283
set method, 283
wait method, 283
Event object (Tkinter module)
attributes, 366
char attribute, 366
keysym attribute, 366
num attribute, 366
widget attribute, 366
x_root attribute, 366
y_root attribute, 366
event scheduler, 249
event-driven applications
GUI applications, 329
network programs, 443-453
events
binding callbacks to, 366
keyboard, 366
mouse, 367
(see also sockets, event-driven programs)
excepthook function (sys module), 114, 138
Exception class (built-in), 109
exception classes
custom, 111
DBAPI, 237
standard, 110-111
exception handling, 104
exception propagation, 107
sys.excepthook, 138
try statement, 104-107
try/except, 105-106
try/finally, 106
exceptions, 104-115
C-coded Python extensions, 526
exception objects, 109-111
custom exception classes, 111
standard exception classes, 110-111
IOError exceptions, 187
pending, gathering information about, 112
raise statement, 108
standard, hierarchy of, 109
exc_info function, sys module, 112, 138
exclamation point (!)
comparisons, 44
pdb command, 384
struct format strings, 195
exec method (PythonInterpreter object), 555
exec statement, 260-262
limiting use of, 260, 401
execfile function (built-in), 132
execfile method (PythonInterpreter object), 555
execl function (os module), 288
execle function (os module), 288
execlp function (os module), 288
executables, self-installing, packages distributed as, 124
execute method (Cursor object), 242
executemany method (Cursor object), 242
execution
dynamic, 260-262
restricted, 262-268
exec statement and, 261
rexec module, 262-266
sandbox environment, 263
execv function (os module), 288
execve function (os module), 288
execvp function (os module), 288
execvpe function (os module), 288
exists function (os.path module), 177
exit function (sys module), 109, 138
exp function
cmath module, 298
math module, 298
expand method (match object), 167
expandNode method (DomEventStream object), 508
expandtabs method (string object), 146
expandvars function (os.path module), 177
expect method (Telnet object), 427
expression statements, 261
expressions, 43
Boolean context, 52
exec statement and, 261
named/positional arguments, 63
operator precedence in, 43
returning results of, 131
extend method (list object), 49
eXtensible Markup Language (see XML)
Extension class (distutils module), 565
extension modules, 4, 126
C-coded, 516-518
errors in, 111
portability and, 5
Python implementations and, 6
resources for further information, 10
writing in lower-level languages, 5
ext_modules argument (distutils setup function), 565
extra_compile_args argument (distutils Extension class), 566
extra_link_args argument (distutils Extension class), 566
extra_objects argument (distutils Extension class), 566
extsep attribute (os module), 173
F[ Top ]
F2PY library, 545
fabs function
cmath module, 298
math module, 298
factory functions, 74
fail method (TestCase object), 379
failIf method (TestCase object), 379
failIfEqual method (TestCase object), 379
failUnless method (TestCase object), 378
failUnlessEqual method (TestCase object), 379
failUnlessRaises method (TestCase object), 379
FancyURLopener class, 412
prompt_user_passwd method, 412
version method, 412
Fast Fourier Transforms (FFTs), 327
FastCGI, 466
fdopen function (os module), 185
Feasts module, 259
February attribute (mx.DateTime module), 259
feed method
HTMLParser object, 488
sgmllib module, 482
XMLReader object, 499
fetchall method (Cursor object), 242
fetchmany method (Cursor object), 242
fetchone method (Cursor object), 242
FFT module, 327
FFTPACK/fftpack libraries, 327
FFTs (Fast Fourier Transforms), 327
FieldStorage class (cgi module), 456
disposition attribute, 457
disposition_options attribute, 457
file attribute, 457
filename attribute, 457
getfirst method, 456
getlist method, 457
getvalue method, 457
headers attribute, 457
name attribute, 457
type attribute, 457
type_option attribute, 457
value attribute, 458
file attribute (FieldStorage object), 457
file descriptors
duplicating, 185
operations on, 184-186
OS-level, 189
file extensions, order of, when searching filesystem for modules, 121
file object (file type), 140, 187-192, 198
attributes, 189-191
close method, 189
closed attribute, 189
creating, 187-189
designating buffering, 188
sequential/nonsequential access, 189
specifying file mode, 187
fileno method, 189
flush method, 189
isatty method, 189
iteration on, 191
memory-mapped (see mmap object)
methods, 189-191
mode attribute, 189
mode of, 187
name attribute, 190
open, alternate way to create, 127
polymorphism and, 191
read method, 190
readline method, 190
readlines method, 190
seek method, 190
softspace attribute, 190
tell method, 191
truncate method, 191
write method, 191
writelines method, 191
xreadlines method, 191
filecmp module, 182-183
cmp function, 182
cmpfiles function, 182
dircmp function, 182
FileInput function (fileinput module), 193
fileinput module, 193
close method, 193
FileInput function, 193
filelineno function, 193
filename function, 193
input function, 193
isfirstline function, 194
isstdin function, 194
lineno function, 194
nextfile function, 194
filelineno function (fileinput module), 193
filename attribute
FieldStorage object, 457
os module, 172
zipfile module, 200
filename function (fileinput module), 193
fileno method (file object), 189
files, 171, 187
buffering, 188
comparing, 182
compressed, 198-203
gzip module, 198
tar archive, 13
zipfile module, 200-203
zlib module, 203
copying, 183
.cpp, 565
creating/opening, 127
.dll, 515
HTML, getting information from, 481-485
information about, retrieving, 176
_ _init_ _.py, 561
.jar, Jython and, 5
jython.jar, 551
MANIFEST, 567
msvcrt.dll, 211
.pythonrc.py, 275
removing, 175
renaming, 175
setting time on, 177
site.py, 274
.so, 515
as symbolic links, 181
text, 171
truncating, 191
(see also file object)
file_size attribute (zipfile module), 200
filesystems, 171
case-sensitive, 179
operations of, 173-186
permissions, 174
searching for modules, 121
filter function (built-in), 132
filterwarnings function (warnings module), 390
find method
mmap object, 293
string object, 146
findall method (regular expression object), 163
first function (bsddb module), 235
firstChild attribute (Node object), 503
firstweekday function (calendar module), 250
flag values, anydbm.open, 231
flags argument (compile function), 161
flags attribute (regular expression object), 163
flash method
Button object, 336
Checkbutton object, 337
Radiobutton object, 339
flat method (array object), 312
_ _float_ _ special method, 98
float type (built-in), 33, 127
floating-point numbers
generating pseudo-random, 301
literals, 34
mathematical functions on, 297
rounding off, 136
in string formats, 153
FloatingPointError exception, 110
floor function
cmath module, 298
math module, 298
_ _floordiv_ _ special method, 97
flush method
file object, 189
mmap object, 293
fmod function
cmath module, 298
math module, 298
focus_set method (Widget object), 333
Font class (tkFont module), 354
actual method, 354
cget method, 354
config method, 354
copy method, 354
for statement, 54-57
else clause, 58
iterators, 55
list comprehensions, 56
range/xrange functions, 55
formal parameters, 59
format function (locale module), 217
formatargspec function (inspect module), 381
formatargvalues function (inspect module), 381
formatdate function (Utils module), 478
formatter attribute (HTMLParser object), 486
formatter module, 486
AbstractFormatter class, 486
AbstractWriter class, 486
DumbWriter class, 487
NullFormatter class, 487
NullWriter class, 487
formatting strings, 151-153
common idioms, 153
conversion characters, 151
specifier syntax, 152
formatwarning function (warnings module), 390
Fortran
-coded libraries, 327
extending Python, 545
forward slash (/)
directory paths, 21
Unix/Windows, 173
division, 43
division operator, 43
determining behavior of, 21
double forward slash (//)
truncating division, 43
found_terminator method (async_chat object), 448
4Suite, 494
Frame class (Tkinter module), 341
frame type, 268
frexp function
cmath module, 298
math module, 298
Friday attribute (mx.DateTime module), 259
from statement
avoiding from...import, 401
importing modules from packages, 124
module object, 119
fromfile method (array object), 303
fromlist method (array object), 303
fromstring function (Numeric module), 311
fromstring method (array object), 303
fstat function (os module), 185
FTE editor, 24
FTP class (ftplib module), 420
connect method, 421
cwd method, 421
delete method, 421
login method, 421
mkd method, 421
pwd method, 421
quit method, 421
rename method, 421
retrbinary method, 421
retrlines method, 422
rmd method, 422
sendcmd method, 422
set_pasv method, 422
size method, 422
storbinary method, 422
storlines method, 422
FTP protocol, 415, 419-423
ftplib module, 420
twisted.protocols package, 450
FTP servers, 420
ftplib module, 407, 420
Full class (Queue module), 278
full method (Queue object), 278
fullname argument (distutils setup function), 562
func_code attribute (method object), 268
function object
func_code attribute, 268
functions, 58-68
attributes of, 61
built-in, 129-137
C-coded Python extension modules, 518
defining, 59
in a class body, 72
function calls, 59, 62-64
arguments, 59, 63
generators, 67
lambda expressions, 66
local variables, 64
namespaces, 64-66
global statement, 64
nested functions/scopes, 65
parameters, 60
recursion, 68
return statement, 62
termination, 273
G[ Top ]
Gadfly, 244
gadfly function (gadfly module), 244
gadfly module, 244
gadfly function, 244
gfclient function, 244
garbage attribute (gc module), 270
garbage collection, 39, 269-273
cyclic garbage, 269
del statements and, 42
disabling, 269, 271
finalizing classes, 91
gc module, 269-272
Jython, 269
reference counts, 139
weakref module, 272
gc module, 269, 269-272
collect function, 269
disable function, 269, 271
enable function, 270
garbage attribute, 270
get_debug function, 270
get_objects function, 270
get_referrers function, 270
get_threshold function, 270
isenable function, 270
set_debug function, 270
set_threshold function, 271
gdbm library, 231
gdbm module, 232
open function, 232
_ _ge_ _ special method, 92
Generator class (Generator module), 476
Generator module, 476
generators, 67
geometry method (Toplevel object), 342
get method
dictionary object, 50
Entry object, 337
Listbox object, 338
PythonInterpreter object, 555
Queue object, 278
Scale object, 340
Text object, 347
getaddresses function (Utils module), 478
get_all method (Message object), 473
getargspec function (inspect module), 381
getargvalues function (inspect module), 381
getatime function (os.path module), 178
getattr function (built-in), 132
_ _getattr_ _ special method, 92
getAttribute method (Element object), 505
_ _getattribute_ _ special method, 82, 86, 92
getAttributeNode method (Element object), 506
getAttributeNodeNS method (Element object), 506
getAttributeNS method (Element object), 506
get_boundary method (Message object), 473
getch function (msvcrt module), 211
getch method (Window object), 209
get_charsets method (Message object), 474
getche function (msvcrt module), 211
getcwd function (os module), 175
get_data method (Request object), 415
get_debug function (gc module), 270
getdefaultencoding function (sys module), 139
getdefaultlocale function (locale module), 217
getDefaultSocketTimeout function (timeoutsocket module), 438
getdoc function (inspect module), 382
getElementById method (Document object), 505
getElementsByTagName method
Document object, 505
Element object, 506
getElementsByTagNameNS method
Document object, 505
Element object, 506
getfile function (inspect module), 382
get_filename method (Message object), 474
getfirst method (FieldStorage object), 456
getfqdn function (socket module), 432
_getframe function (sys module), 139, 268
get_full_url method (Request object), 415
getheader method (HTTPResponse object), 419
get_history_length function (readline module), 207
get_host method (Request object), 415
getHost method (transports object), 451
gethostbyaddr function (socket module), 432
gethostbyname_ex function (socket module), 432
getinfo function
ZipFile class, 201
_ _getinitargs_ _ special method, 228
getitem method (operator module), 299
_ _getitem_ _ special method, 96
getline function (linecache module), 195
getlist method (FieldStorage object), 457
getlocale function (locale module), 217
get_maintype method (Message object), 474
getmaintype method (Message object), 480
getmembers function (inspect module), 382
getmodule function (inspect module), 382
getmro function (inspect module), 382
getmtime function (os.path module), 178
getName method (Thread object), 280
getNameByQName method (Attributes object), 498
get_nowait method (Queue object), 278
get_objects function (gc module), 270
getopt function (getopt module), 141
GetoptError exception, 141
getparam method (Message object), 480
getparams method (Message object), 474
getpass function (getpass module), 205
getpass module, 205
getpass function, 205
getuser function, 206
get_payload method (Message object), 474
getPeer method (transports object), 452
getpeername method (socket object), 434
getQNameByName method (Attributes object), 498
getQNames method (Attributes object), 498
getrecursionlimit function (sys module), 139
getrefcount function (sys module), 139, 269
get_referrers function (gc module), 270
getresponse method (HTTPConnection object), 419
get_selector method (Request object), 415
getsize function (os.path module), 178
getslice method (operator module), 299
getsource function (inspect module), 382
getsourcefile function (inspect module), 382
getsourcelines function (inspect module), 382
getstate method (Random object), 300
get_subtype method (Message object), 474
getsubtype method (Message object), 480
gettags method (Canvas object), 357
gettext module, 220-222
install function, 221
translation function, 221
get_threshold function (gc module), 270
get_timeout method (TimeoutSocket object), 438
get_type method
Message object, 475
Request object, 415
gettype method (Message object), 480
get_unixfrom method (Message object), 475
geturl method (URL file-like object), 411
getuser function (getpass module), 206
getvalue method, 198
FieldStorage object, 457
file object, 198
getValueByQName method (Attributes object), 498
getweakrefcount function (weakref module), 272
getweakrefs function (weakref module), 272
getyz method (Window object), 210
gfclient function (gadfly module), 244
GIF (Graphical Interchange Format), 335
Glimmer program, 24
global statement, 64
global variables, 40, 64
thread synchronization and, 281
globals function (built-in), 132
gmt function (mx.DateTime module), 253
GMT (Greenwich Mean Time), 245
retrieving current, 253
gmticks method (DateTime class), 255
gmtime function
mx.DateTime module, 253
time module, 247
gmtime method (DateTime class), 255
gmtoffset method (DateTime class), 255
GNU Public License (GPL), 7
GNU Readline Library, 206
gopher, 415
GPL (GNU Public License), 7
grab_release method (Widget object), 333
grab_set method (Widget object), 333
Graphical Interchange Format (GIF), 335
graphical user interfaces (see GUIs)
greater than sign (>)
comparisons, 44
double greater than (>>)
right shift, 43
struct format strings, 195
Greenwich Mean Time (see GMT)
Gregorian calendar, 252
grid method (Widget object), 363
grid_forget method (Widget object), 364
grid_info method (Widget object), 364
group method
match object, 167
NNTP object, 425
groupdict method (match object), 168
groupindex attribute (regular expression object), 163
groups method (match object), 167
_ _gt_ _ special method, 92
GUIs (graphical user interfaces), 328
scripts, running standalone, 329
Tkinter, 328-370
toolkits, 328
gunzip program, 13, 198
gzip module, 198
GzipFile class, 198
open function, 199
gzip program, 198
GzipFile class (gzip module), 198
H[ Top ]
handle function, cgitb module, 460
handle method
BaseRequestHandler object, 439
HTTPServer object, 440
handle_accept method (dispatcher object), 446
handle_charref method
HTMLParser object, 488
sgmllib module, 482
handle_close method (dispatcher object), 447
handle_comment method
HTMLParser object, 488
sgmllib module, 483
handle_connect method, dispatcher object, 447
handle_data method
HTMLParser object, 489
sgmllib module, 483
handle_endtag method
HTMLParser object, 489
sgmllib module, 483
handle_entityref method
HTMLParser object, 489
sgmllib module, 483
handle_image method (HTMLParser object), 486
handle_read method (dispatcher object), 447
handle_starttag method
HTMLParser object, 489
sgmllib module, 483
handle_write method (dispatcher object), 447
hasattr function (built-in), 132
hasAttribute method (Element object), 506
hasAttributeNS method (Element object), 506
hasChildNodes method (Node object), 503
has_data method (Request object), 415
hash function (built-in), 37, 132
_ _hash_ _ special method, 82, 93
hashopen function (bsddb module), 234
has_key function (bsddb module), 235
has_key method (dictionary object), 50
head method (NNTP object), 425
header lines, 52
headers, 33
headers attribute (FieldStorage object), 457
hex function (built-in), 133
_ _hex_ _ special method, 98
hexadecimal literals, 33
hexdigits attribute (string module), 149
hierarchy of stardard exceptions, 109
hour attribute
DateTime class, 256
DateTimeDelta class, 258
hours attribute (DateTimeDelta class), 258
HPUX, Python IDEs, 23
HTML forms, CGI scripting, 455
HTML (HyperText Markup Language), 481-493
debugging, 486
documents
outputting, 509
parsing, 481
entity references, 483
files, getting information from, 481-485
formatter module, 486
generating, 490-493
embedding Python code, 490
by templating, 490
(see also Cheetah package)
htmlentitydefs module, 487
htmllib module, 485
parsing HTML, 487
HTMLParser module, 488-490
sgmllib module, 481-485
tags, 483
HTML Version 2.0, tags defined in, 485
htmlentitydefs module, 487
htmllib module, 485
HTMLParser class
anchor_bgn method, 485
anchor_end method, 485
anchorlist attribute, 485
close method, 488
do_tag method, 485
end_tag method, 485
feed method, 488
formatter attribute, 486
handle_charref method, 488
handle_comment method, 488
handle_data method, 489
handle_endtag method, 489
handle_entityref method, 489
handle_image method, 486
handle_starttag method, 489
htmllib module, 485
HTMLParser module, 488
nofill attribute, 486
save_bgn method, 486
save_end method, 486
start_tag method, 485
HTMLParser module, 488-490
HTMLParser class, 488
htonl/htons functions (socket module), 432, 433
HTTP protocol, 415, 419-423
cookies and, 462
httplib module, 419
twisted.protocols package, 450
(see also urllib module; urllib2 module)
HTTP servers, 419
methods/attributes, 440
sockets and, 440
BaseHTTPServer module, 440
CGIHTTPServer module, 442
SimpleHTTPServer module, 441
SimpleXMLRPCServer module, 442
HTTPBasicAuthHandler class, 416
HTTPConnection class, 419
close method, 419
getresponse method, 419
request method, 420
HTTPDigestAuthHandler class, 416
httplib module, 407, 419
HTTPPasswordMgrWithDefaultRealm class, 416
HTTPResponse object
getheader method, 419
msg method, 419
read method, 419
reason method, 420
status method, 420
version method, 420
https protocol, 415, 419-423
twisted.protocols package, 450
HTTPSConnection class, 420
HTTPServer class, 440
command attribute, 440
end_headers method, 440
handle method, 440
path method, 440
rfile method, 441
send_error method, 441
send_header method, 441
send_response method, 441
wfile method, 441
HyperText Markup Language (see HTML)
hyphen (-)
regular expressions, 159
string formatting, 152
subtraction, 43
unary minus, 43
hypot function
cmath module, 298
math module, 298
I[ Top ]
_ _iadd_ _ special method, 98
_ _iand_ _ special method, 99
IBM AS/400, installing Python, 17
IBM DB/2, 243
iconify method (Toplevel object), 342
id function (built-in), 133
identchars attribute (cmd module), 214
identifiers, 30, 43
characters not allowed in, 30
identity function (Numeric module), 311
IDEs (Integrated Development Environments), 19
_ _idiv_ _ special method, 98
IDLE (Interactive DeveLopment Environment), 23
debugging in, 388
if statements, 52
continue statements in place of, 57
_ _ifloordiv_ _ special method, 98
ignore command (pdb module), 386
IGNORECASE attribute (re module), 161
_ _ilshift_ _ special method, 99
imag method (array object), 312
image_create method (Text object), 347
images, supported by Tkinter module, 335
imaginary method (array object), 312
IMAP4 (Internet Message Access Protocol Version 4), 416
immutable objects, 33
_ _imod_ _ special method, 98
implementations of Python, 5-7
_ _import_ _ function (built-in), 120, 123, 129
import statement, 117-119
ImportError exception, 110
_ _imul_ _ special method, 98
include_dirs argument (distutils Extension class), 566
IndentationError exception, 110
index method
list object, 49
string object, 146
Text object, 353
Indexed-Sequential Access Method (ISAM), 230
IndexError exception, 110
indexing
dictionaries, 50
sequences, 47
targets, 41
indexOf method (operator module), 299
indices function (Numeric module), 319
industry-specific markup languages, 494
inet_aton function (socket module), 433
inet_ntoa function (socket module), 433
info method (URL file-like object), 411
infolist function (ZipFile class), 201
InfoZip zlib compression library, 203
inheritance
classic classes, 70, 79-81
delegating to superclass methods, 80
"deleting" class attributes, 81
overriding attributes, 80
new-style object model, 88-90
cooperative superclass method calling, 89
method resolution order, 88
_ _init_ _ special method, 73, 83, 93
_ _init_ _.py file, 561
innerproduct function (Numeric module), 319
input function
built-in, 133, 205
safer variant of, 265
fileinput module, 193
insert method
Entry object, 337
list object, 49
Listbox object, 338
Menu object, 345
Text object, 347
insertBefore method (Node object), 510
insert_cascade method (Menu object), 345
insert_checkbutton method (Menu object), 345
insert_command method (Menu object), 345
insert_radiobutton method (Menu object), 345
insert_separator method (Menu object), 345
insort function (bisect module), 143
inspect module, 268, 380-383
currentframe function, 381
formatargspec function, 381
formatargvalues function, 381
getargspec function, 381
getdoc function, 382
getfile function, 382
getmembers function, 382
getmodule function, 382
getmro function, 382
getsource function, 382
getsourcefile function, 382
getsourcelines function, 382
isbuiltin function, 382
isclass function, 382
iscode function, 382
isframe function, 382
isfunction function, 382
ismethod function, 382
ismodule function, 382
isroutine function, 382
stack function, 383
insstr method (Window object), 210
install function (gettext module), 221
Installer tool, 569
installing, 12-18
C-coded Python extensions, 516
CPython, 12
Jython, 12, 17
platform-specific installers, packages distributed as, 124
Python from binaries, 16
Python from source code, 12-16
Macintosh, 16
Unix, 15
Windows, 13-15
resident extension modules, 546
install_opener function (urllib2 module), 413
instances
of classic classes, 73-75
attributes, 74
factory functions, 74
of new-style classes, 84-88
per-instance methods, 87
_ _int_ _ special method, 98
int type (built-in), 33, 127
integers
bitwise operations on, numeric operations and, 46
converting numbers to, 127
converting to hexadecimal strings, 133
converting to octal strings, 135
largest in this version of Python, retrieving, 139
literals, 33
retrieving list of in arithmetic progression, 135
Integrated Development Environments (IDEs), 19
interact method (Telnet object), 428
Interactive DeveLopment Environment (see IDLE)
interactive sessions, 22, 212-215
isatty function (file object), 189
Python interpreter, 22
readline module, 206
sys.displayhook, 138
internal types, 268
internationalization, 171
codecs module, 155
currency formatting, 218
gettext module, 220-222
locale module, 215-220
localization, 220-222
Internet Message Access Protocol Version 4 (IMAP4), 416
Internet Protocol (IP), 432
Internet servers, 438-443
interoperability, Python release and debugging builds, 14
inter-process communication (see IPC)
intro attribute (cmd module), 214
invert method (operator module), 300
_ _invert_ _ special method, 97
invoke method
Button object, 336
Checkbutton object, 337
Menu object, 345
Radiobutton object, 340
I/O operations
auxiliary modules for, 192-197
fileinput, 193
linecache, 194
struct, 195
xreadlines, 197
error streams, 140
failure of, 110
optimizing, 403
richer-text Input/output, 206-212
console I/O, 208-212
readline module, 206-207
StringIO/cStringIO modules, 197
text Input/output, 204-206
getpass module, 205
print statement, 204
standard input, 205
standard output/standard error, 204
IOError exceptions, 110, 187
_ _ior_ _ special method, 99
IP (Internet Protocol), 432
IPC (inter-process communication), 276
cross-platform mechanism (see mmap module)
mmap object, using for, 295
_ _ipow_ _ special method, 99
_ _irshift_ _ special method, 99
isabs function (os.path module), 178
isAlive method (Thread object), 280
isalnum method (string object), 146
isalpha method (string object), 146
ISAM (Indexed-Sequential Access Method), 230
ISAPI, 466
isatty method (file object), 189
isbuiltin function (inspect module), 382
isclass function (inspect module), 382
iscode function (inspect module), 382
iscontiguous method (array object), 313
isDaemon method (Thread object), 280
isdigit method (string object), 146
isdir function (os.path module), 178
isenabled function (gc module), 270
isfile function (os.path module), 178
isfirstline function (fileinput module), 194
isframe function (inspect module), 382
isfunction function (inspect module), 382
isinstance function (built-in), 33, 73, 133
isleap function (calendar module), 251
islink function (os.path module), 178
islower method (string object), 147
ismethod function (inspect module), 382
ismodule function (inspect module), 382
ismount function (os.path module), 178
is_multipart method (Message object), 475
ISO 8601 formats, time/date values in, 259
ISO module, 259
ISO-compliant C compiler, installing Python and, 12
is_output method
Morsel object, 464
SimpleCookie object, 464
SmartCookie object, 464
iso_week attribute (DateTime class), 256
isroutine function (inspect module), 382
isSameNode method (Node object), 503
isSet method (Event object), 283
isspace method (string object), 147
isstdin function (fileinput module), 194
issubclass function (built-in), 70, 133
istitle method (string object), 147
_ _isub_ _ special method, 98
isupper method (string object), 147
is_zipfile function (zipfile module), 200
itemcget method (Canvas object), 357
itemconfig method (Canvas object), 357
items, 40
returning largest/smallest, 135
items method (dictionary object), 50
itemsize method (array object), 313
iter function (built-in), 55, 133
_ _iter_ _ special method, 96
iteration
file object, 191
iterators, 55
creating, 133
Python versions, 191
iteritems method (dictionary object), 50
iterkeys method (dictionary object), 50
itervalues method (dictionary object), 50
_ _itruediv_ _ special method, 98
_ _ixor_ _ special method, 99
J[ Top ]
January attribute (mx.DateTime module), 259
.jar files, Jython and, 5
jarray module, 552
array function, 553
zeros function, 553
Java
classes, subclassing, 554
compiling Python into, 557-559
adding Java-visible methods, 558
jythonc command, 557
Python applets/servlets, 559
embedding Jython, 554-557
Py class, 557
PyObject class, 556
PythonInterpreter class, 554
Java Development Kit (JDK), 17
Java Native Interface (JNI), 550
Java packages, importing in Jython, 551-554
accessibility, 551
JavaBeans, 554
Jython registry, 551
subclassing Java classes, 554
type conversions, 552
Java Virtual Machines (see JVMs)
JavaBeans, 554
java.util collection classes, 553
JDK (Java Development Kit), 17
JNI (Java Native Interface), 550
join function (os.path module), 178
join method
string object, 147
Thread object, 280
July attribute (mx.DateTime module), 259
jumpahead method (Random object), 301
June attribute (mx.DateTime module), 259
JVMs (Java Virtual Machines), 5
Jython installation and, 17
Jython, 5
documentation, 8
embedding in Java, 554-557
Py class, 557
PyObject class, 556
PythonInterpreter class, 554
garbage collection, 269
importing Java packages, 551-554
accessibility, 551
JavaBeans, 554
Jython registry, 551
subclassing Java classes, 554
type conversions, 552
installing, 12, 17
Jython API
Py class, 557
PyObject class, 556
PythonInterpreter class, 554
jython interpreter, 25
jythonc command, 557
jython.jar file, 551
K[ Top ]
kbhit function (msvcrt module), 211
key attribute (Morsel object), 464
keyboard events, 366
KeyboardInterrupt exception, 110
keyed access, 230
KeyError exception, 110
keys function (bsddb module), 235
keys method (dictionary object), 50
keysym attribute (Event object), 366
keywords argument (distutils setup function), 562
keywords, list of, 31
Komodo, 23
L[ Top ]
Label class (Tkinter module), 338
lambda expressions, 66
LAPACKlapack_lite libraries, 327
last method
bsddb module, 235
NNTP object, 425
lastChild attribute (Node object), 503
lastcmd attribute (cmd module), 214
lastgroup attribute (match object), 167
lastindex attribute (match object), 167
layout manager, 329
LBYL (look before you leap), 112
LC_COLLATE attribute (locale module), 216
LC_CTYPE attribute (locale module), 216
LC_MESSAGES attribute (locale module), 216
LC_MONETARY attribute (locale module), 216
LC_NUMERIC attribute (locale module), 216
LC_TIME attribute (locale module), 216
ldexp function
cmath module, 298
math module, 298
_ _le_ _ special method, 92
leapdays function (calendar module), 251
len function (built-in), 46, 49, 134
_ _len_ _ special method, 97, 556
less than sign (<)
comparisons, 44
double less than (<<)
left shift, 43
struct format string, 195
Lesser GPL (LGPL), 7
letters attribute (string module), 149
LGPL (Lesser GPL), 7
libraries argument (distutils Extension class), 566
library_dirs argument (distutils Extension class), 566
license argument (distutils setup function), 562
LinearAlgebra module, 327
linecache module, 194
checkcache function, 194
clearcache function, 195
getline function, 195
line-completion functionality, 207
lineno function (fileinput module), 194
linesep attribute (os module), 173
Linux
installing Python from binaries, 17
Python IDEs, 23
Red Hat Linux releases 6.x/7.x
Python v1.5.2 and, 8
support for cryptographic-quality pseudo-random numbers, 300
list command (pdb module), 387
list comprehensions, 56
list method
NNTP object, 425
POP3 object, 417
list object (list type), 37, 128
append method, 49
count method, 49
extend method, 49
index method, 49
insert method, 49
pop method, 49
remove method, 49
reverse method, 49
sort method, 49
Listbox class (Tkinter module), 338
curselection method, 338
delete method, 338
get method, 338
insert method, 338
select_clear method, 339
select_set method, 339
listbox widgets, 338
listdir function (os module), 175
listen method (socket object), 434
listenTCP method (reactor object), 451
listMethods method (ServerProxy object), 430
lists, 37
maintaining order of, 143
methods, 49
modifying, 48
optimizing operations on, 395
sequence operations on, 48
literals, 32, 43
ljust method (string object), 147
load method
SimpleCookie object, 464
SmartCookie object, 464
loading modules, 120-123, 136
built-in, 121
circular imports, 122
custom importers, 123
dictionary listing names, 139
_ _import_ _ function, 129
main program and, 122
reload function, 122
searching filesystem, 121
specifying directory paths, 139
sys.modules entries, 123
load/loads functions
marshal module, 224
pickle/cPickle modules, 226
local variables, 40, 64
LOCALE attribute (re module), 161
locale module, 215-220
atof function, 217
atoi function, 217
attributes, 216
format function, 217
getdefaultlocale function, 217
getlocale function, 217
localeconv function, 218
normalize function, 219
resetlocale function, 219
setlocale function, 219
str function, 219
strcoll function, 219
strxfrm function, 219
locale sensitivity, string module (see locale module)
localeconv function (locale module), 218
localName attribute (Node object), 503
locals function (built-in), 134
localtime function
mx.DateTime module, 254
time module, 247
localtime method (DateTime class), 255
lock object, 281
acquire method, 277
locked method, 277
release method, 278
locked method (lock object), 277
log function
cmath module, 298
math module, 298
log10 function
cmath module, 298
math module, 298
logging errors, 114
by rebinding excepthook attribute, 138
login method
FTP object, 421
SMTP object, 418
long integers, 33
_ _long_ _ special method, 98
long type (built-in), 33, 128
Long-Running Web Processes (LRWP), 466
look before you leap (LBYL), 112
LookupError exception, 109
loop function (asyncore module), 446
loops, optimizing, 402
loseConnection method (transports object), 452
lower method (string object), 147
lowercase attribute (string module), 149
LRWP (Long-Running Web Processes), 466
lseek function (os module), 185
lshift method (operator module), 300
_ _lshift_ _ special method, 98
lstrip method (string object), 147
_ _lt_ _ special method, 92
M[ Top ]
MA module, 327
Macintosh
installing Python, 16
internationalization, 155
Mac OS 9/Mac OS X, 16
Python IDE, 23
Python interpreter on, 20
MacPython, IDE included with, 23
mail protocol, 407
mailing lists, 9
main program, module loading and, 122
mainloop method (Widget object), 333
maintainer argument (distutils setup function), 562
maintainer_email argument (distutils setup function), 562
make utility, installing Python and, 12
makedirs function (os module), 175
makefile method (socket object), 434
make_parser function (xml.sax package), 496
maketrans function (string module), 150
mandatory parameters, 60
Mandrake Linux, installing Python, 17
MANIFEST files, 567
map function (built-in), 134
mappings, 37
indexing, error, 110
mutable, 143
special methods for, 95
March attribute (mx.DateTime module), 259
mark_gravity method (Text object), 349
mark_set method (Text object), 350
mark_unset method (Text object), 350
markup, 481
marshal module, 224
dump/dumps functions, 224
load/loads functions, 224
polymorphism and, 192
marshaling, 224
match method (regular expression object), 164, 166
match object, 166-168
attributes, 166
end method, 167
expand method, 167
group method, 167
groupdict method, 168
groups method, 167
span method, 167
start method, 167
math module, 297-299
acos function, 297
acosh function, 297
asin function, 297
asinh function, 297
atan/atan2 functions, 297
atanh function, 297
ceil function, 297
cos function, 297
cosh function, 297
exp function, 298
fabs function, 298
floor function, 298
fmod function, 298
frexp function, 298
hypot function, 298
ldexp function, 298
log function, 298
log10 function, 298
modf function, 298
pow function, 298
sin function, 299
sinh function, 299
sqrt function, 299
tan function, 299
matrixmultiply function (Numeric module), 319
max function (built-in), 46, 135
maxint attribute (sys module), 139
maxsize method (Toplevel object), 342
May attribute (mx.DateTime module), 259
mbcs codec (Windows), 155
memory
array type and, 302
leaks, exposing, 269
running out of, 110
saving, _ _slots_ _ attribute, 86
storing array object, 306
MemoryError exception, 110
Menu class (Tkinter module), 344
add method, 344
add_cascade method, 344
add_checkbutton method, 344
add_command method, 344
add_radiobutton method, 344
add_separator method, 344
delete method, 345
entryconfigure method, 345
insert method, 345
insert_cascade method, 345
insert_checkbutton method, 345
insert_command method, 345
insert_radiobutton method, 345
insert_separator method, 345
invoke method, 345
post method, 345
unpost method, 345
menu widgets, 344-347
entry options, 345
Message class
add_header method, 473
add_payload method, 473
as_string method, 473
epilogue attribute, 473
get_all method, 473
get_boundary method, 473
get_charsets method, 474
get_filename method, 474
get_maintype method, 474
getmaintype method, 480
getparam method, 480
get_params method, 474
get_payload method, 474
get_subtype method, 474
getsubtype method, 480
get_type method, 475
gettype method, 480
get_unixfrom method, 475
is_multipart method, 475
Message module, 472
mimetools module, 479
preamble attribute, 475
rfc822 module, 479
set_boundary method, 475
set_payload method, 475
set_unixfrom method, 475
walk method, 475
Message module, 472-475
Message class, 472
message_from_file function (Parser module), 472
message_from_string function (Parser module), 472
metaclasses, 100-103
custom example, 102
defining, 101
how Python determines, 100
method object, func_code attribute, 268
methodHelp method (ServerProxy object), 430
methods, 59, 70
bound, 77-79
callable attributes as, 40
class-level, 82
class, 83
static, 82
cooperative superclass, 89
dictionary, 50
Java-visible, adding, 558
lists, 49
per-instance, 87
resolution order in new-style object model, 88
special, 70, 90-99
for containers, 94-97
general purpose, 90-94
for numeric objects, 97-99
superclass, delegating to, 80
unbound, 77-79
methodSignature method (ServerProxy object), 430
Microsoft Installer (MSI), 16
Microsoft Intermediate Language (MSIL), 6
Microsoft Jet, 243
Microsoft .NET, 6
Microsoft SQL Server, 243
Microsoft web servers, installing Python CGI scripts on, 461
MIME (Multipurpose Internet Mail Extensions), 469, 472-479
MIMEAudio class (MIMEAudio module), 476
MIMEBase class (MIMEBase module), 476
MIMEImage class (MIMEImage module), 477
MIMEMessage class (MIMEMessage module), 477
MIMEText class (MIMEText module), 477
mimetools module, Message class, 479
min function (built-in), 46, 135
minidom module, 502-506
Attr class, 504
AttributeList class, 502
Document class, 505, 509
Element class, 505, 509
Node class, 503, 510
parse function, 502
parseString function, 502
parsing XHTML, 507
XHTML, changing/outputting, 511
minsize method (Toplevel object), 342
minute attribute
DateTime class, 256
DateTimeDelta class, 258
minutes attribute (DateTimeDelta class), 258
mkd method (FTP object), 421
mkdir function (os module), 175
mktime function
mx.DateTime module, 254
time module, 247
mktime_tz function (Utils module), 478
MLab module, 326
mmap function (mmap module), 292
mmap module, 292-295
mmap object, 292-295
close method, 293
find method, 293
flush method, 293
move method, 293
read method, 293
read_byte method, 294
readline method, 294
resize method, 294
seek method, 294
size method, 294
tell method, 294
using for IPC, 295
write method, 294
write_byte method, 295
mod method (operator module), 300
_ _mod_ _ special method, 97
mode attribute (file object), 189
modf function
cmath module, 298
math module, 298
modifying lists, 48
mod_python, 467
module object
_ _all_ _ attribute, 120
_ _dict_ _ attribute, 118
_ _doc_ _ attribute, 119
_ _name_ _ attribute, 118
modules, 24, 116-125
DBAPI-compliant, 243
loading, 120-123, 136
circular imports, 122
custom importers, 123
dictionary listing names, 139
_ _import_ _ function, 129
main program and, 122
reload function, 122
searching filesystem, 121
specifying directory paths, 139
sys.modules entries, 123
module initialization, Python C API extensions, 518
module object, 116-120
attributes, 117
built-in, 118
docstrings, 119
from statement, 119
import statement, 117-119
module-private variables, 119
nesting, 124
packages and, 124
resident extension, installing, 546
returning dictionary of, 132
(see also built-in modules; extension modules)
modules attribute (sys module), 120, 139
_ _import_ _ function and, 123
Monday attribute (mx.DateTime module), 259
month attribute (DateTime class), 256
Month attribute (mx.DateTime module), 259
month function (calendar module), 251
monthcalendar function (calendar module), 251
monthrange function (calendar module), 251
Morsel class (Cookie module), 463
coded_value attribute, 464
is_output method, 464
key attribute, 464
output method, 465
OutputString method, 465
set method, 465
value attribute, 464
mouse events, 367
move method
mmap object, 293
Window object, 210
msg method (HTTPResponse object), 419
MSI (Microsoft Installer), 16
MSIL (Microsoft Intermediate Language), 6
mssqldb module, 243
msvcrt module, 211
getch function, 211
getche function, 211
kbhit function, 211
ungetch function, 211
msvcrt.dll file, 211
mul method (operator module), 300
_ _mul_ _ special method, 97
MULTILINE attribute (re module), 161
Multipurpose Internet Mail Extensions (see MIME)
mutable objects, 33
shelve module and, 229
mx package, 252
mx.DateTime module, 252-259
April attribute, 259
attributes, 256, 259
August attribute, 259
cmp function, 259
Date function, 253
DateFromTicks function, 253
DateTime class, 252-254
DateTime function, 253
DateTimeDelta class, 257
DateTimeFrom function, 253
DateTimeFromAbsDays function, 253
DateTimeFromCOMDays function, 253
December attribute, 259
February attribute, 259
Friday attribute, 259
gmt function, 253
gmtime function, 253
January attribute, 259
July attribute, 259
June attribute, 259
localtime function, 254
March attribute, 259
May attribute, 259
methods, 254
mktime function, 254
Monday attribute, 259
Month attribute, 259
November attribute, 259
now function, 254
October attribute, 259
oneDay attribute, 259
oneHour attribute, 259
oneMinute attribute, 259
oneSecond attribute, 259
oneWeek attribute, 259
RelativeDateTime type, 252
Saturday attribute, 259
September attribute, 259
Sunday attribute, 259
Thursday attribute, 259
Timestamp function, 253
TimestampFrom function, 253
TimestampFromTicks function, 254
today function, 254
Tuesday attribute, 259
utctime function, 253
Wednesday attribute, 259
Weekday attribute, 259
mxODBC module, 243
MySQL, 243
MySQLdb module, 243
N[ Top ]
name argument (distutils setup function), 562
_ _name_ _ attribute
class object, 71
function object, 61
module object, 118
name attribute
FieldStorage object, 457
file object, 190
os module, 172
named arguments, 63
NameError exception, 110
namelist function (ZipFile class), 201
Namespaces, 494
namespaces, 64-66
current local, 134
global statement, 64
nested functions/scopes, 65
namespaceURI attribute (Node object), 503
_ _ne_ _ special method, 92
neg method (operator module), 300
_ _neg_ _ special method, 97
nested functions, 65
nested scopes, 65
network encodings, 469-480
network news, 423-427
nntplib module, 423
methods, 424
response strings, 424
Network News Transport Protocol (see NNTP)
network protocol modules
client-side, 407-430
distributed computing, 428-430
email protocols, 416-419
FTP protocol, 419-423
HTTP protocol, 419-423
https protocol, 419-423
network news, 423-427
telnet protocol, 427
URL access, 407-416
server-side, 431-453
Internet, 438-443
_ _new_ _ special method, 82, 84, 93
newgroups method (NNTP object), 425
newline (\n), string literals, 35
newnews method (NNTP object), 426
newsgroups, 9
new-style classes (see classes, new-style)
next command (pdb module), 387
next method
bsddb module, 235
NNTP object, 426
nextfile function (fileinput module), 194
nextSibling attribute (Node object), 503
NIST module, 259
NNTP class, 423
article method, 424
body method, 424
group method, 425
head method, 425
last method, 425
list method, 425
newgroups method, 425
newnews method, 426
next method, 426
post method, 426
quit method, 426
stat method, 426
NNTP (Network News Transport Protocol), 407, 423
nntplib module, 407, 423
methods, 424
response strings, 424
Node class (minidom module), 503, 510
appendChild method, 510
attributes attribute, 503
childNodes attribute, 503
firstChild attribute, 503
hasChildNodes method, 503
insertBefore method, 510
isSameNode method, 503
lastChild attribute, 503
localName attribute, 503
methods of, 510
namespaceURI attribute, 503
nextSibling attribute, 503
nodeName attribute, 503
nodeType attribute, 504
nodeValue attribute, 504
normalize method, 504
ownerDocument method, 504
parentNode method, 504
prefix method, 504
previousSibling method, 504
removeChild method, 510
replaceChild method, 510
toprettyxml method, 510
toxml method, 510
writexml method, 510
nodelay method (Window object), 210
nodeName attribute (Node object), 503
nodeType attribute (Node object), 504
nodeValue attribute (Node object), 504
nofill attribute (HTMLParser object), 486
nok_builtin_names attributes (RExec object), 265
None type, 38
nonpure distributions, 560
nonzero function (Numeric module), 319
_ _nonzero_ _ special method, 93
normalDate.py, 245
normalize function (locale module), 219
normalize method (Node object), 504
normcase function (os.path module), 179
normpath function (os.path module), 179
not_ method (operator module), 300
notify method (Condition class), 282
notifyAll method (Condition class), 282
NotImplementedError exception, 110
November attribute (mx.DateTime module), 259
now function (mx.DateTime module), 254
NullFormatter class (formatter module), 487
NullWriter class (formatter module), 487
num attribute (Event object), 366
numarray module, 303
numbers, 33
converting, 127
dividing, 131
floating-point
converting to, 127
generating pseudo-random, 301
math functions on, 297
rounding off, 136
integer literals, 33
pseudo-random, 300
returning absolute value of, 130
Numeric module, 296, 303, 303-322
allclose function, 316
arange function, 310
argmax function, 316
argmin function, 316
argsort function, 316
array function, 309
array module and, 302
array object, 304-322
indexing, 306
shape attribute, 305
slicing, 307-309
type codes, 304
array object (Numeric module)
storing, 306
array2string function, 316
arrayrange function, 310
attributes, 312-314
average function, 317
blitz function, 545
choose function, 317
clip function, 317
compress function, 317
concetenate function, 318
convolve function, 318
cross_correlate function, 318
diagonal function, 318
extending CPython with Fortran, 545
fromstring function, 311
identity function, 311
indices function, 319
innerproduct function, 319
matrixmultiply function, 319
methods, 312-314
nonzero function, 319
numeric objects, special methods for, 97-99
ones function, 311
optional modules supplied by, 326
put function, 319
putmask function, 319
rank function, 320
ravel function, 320
repeat function, 320
reshape function, 320
resize function, 320
searchsorted function, 320
shape attribute, 305
shape function, 321
size function, 321
sort function, 321
swapaxes function, 321
take function, 321
trace function, 322
transpose function, 322
ufunc object supplied by, 325
ufuncs, 322-323
where function, 322
zeros function, 311
numeric operations, 44-46
arithmetic operations, 45
bitwise operations on integers, 46
coercion/conversions, 45
comparing, 46
numeric processing, 296-327
array module, 301-303
math/cmath modules, 297-299
Numeric module (see Numeric module)
operations on arrays, 314
broadcasting, 315
(see also operators; built-in functions)
O[ Top ]
O_APPEND attribute (os module), 186
O_BINARY attribute (os module), 186
object models, 69
classic, 70-81
inheritance in, 79-81
new-style, 81-90
inheritance in, 88-90
object type (built-in), 81, 128
_ _repr_ _ method, 82
object-oriented Python, 69-103
objects
assigning (see assignment statements)
first-class, classes as, 70
mutable/immutable, 33
shelve module and, 229
serializing/deserializing, 224-230
O_CREAT attribute (os module), 186
oct function (built-in), 135
_ _oct_ _ special method, 98
octal literals, 33
octal strings, converting integers to, 135
octdigits attribute (string module), 150
October attribute (mx.DateTime module), 259
odbc module, 243
ODBC (Open DataBase Connectivity), 243
O_DSYNC attribute (os module), 186
O_EXCL attribute (os module), 186
ok_builtin_modules attributes (RExec object), 265
ok_path attributes (RExec object), 265
ok_posix_names attributes (RExec object), 265
ok_sys_names attributes (RExec object), 265
O_NDELAY attribute (os module), 186
onecmd function (cmd module), 213
oneDay attribute (mx.DateTime module), 259
oneHour attribute (mx.DateTime module), 259
oneMinute attribute (mx.DateTime module), 259
ones function (Numeric module), 311
oneSecond attribute (mx.DateTime module), 259
oneWeek attribute (mx.DateTime module), 259
O_NOCTTY attribute (os module), 186
O_NONBLOCK attribute (os module), 186
Open DataBase Connectivity (ODBC), 243
open function
anydbm module, 231
codecs module, 156
dbhash module, 232
dbm module, 232
dumbdbm module, 232
gdbm module, 232
gzip module, 199
os module, 186
shelve module, 229
(see also open function (built-in) )
open function (built-in)
creating file object, 187-189
designating buffering, 188
sequential/nonsequential access, 189
specifying file mode, 187
restricted execution, 264
open method (Telnet object), 428
OpenDirector class, 415
OpenerDirector class, handler classes, 415
operations
arithmetic, 45
dictionary, 49
in-place, 315
numeric, 44-46
bitwise operations on integers, 46
coercion/conversions, 45
comparing, 46
sequence, 46-49
coercion/conversions, 46
concatenation, 46
indexing, 47
lists, 48
slicing, 47
strings, 47
tuples, 48
operator module
abs method, 299
add method, 299
and_ method, 299
concat method, 299
contains method, 299
countOf method, 299
delitem method, 299
delslice method, 299
div method, 299
getitem method, 299
getslice method, 299
indexOf method, 299
invert method, 300
lshift method, 300
mod method, 300
mul method, 300
neg method, 300
not_ method, 300
or_ method, 300
pos method, 300
repeat method, 300
rshift method, 300
setitem method, 300
setslice method, 300
sub method, 300
truth method, 300
xor_ method, 300
operators
list of, 31
precedence in expressions, 43
optimization, 371, 391-404
benchmarking, 393
developing Python applications, 392
large-scale, 393-396
dictionary operations, 396
list operations, 395
string operations, 395
profiling, 396
pstats module, 397
small-scale, 399-404
avoiding exec/from...import statements, 401
building strings from pieces, 400
optimizing I/O, 403
optimizing loops, 402
searching/sorting, 400
optimize flag, 115
optional parameters, 60
options, command-line
parsing, 141
Python interpreter, 20
or_ method (operator module), 300
_ _or_ _ special method, 98
Oracle RDBMS, 243
ord function (built-in), 135
O_RDONLY attribute (os module), 186
O_RDWR attribute (os module), 186
org.python.core package, 556
O_RSYNC attribute (os module), 186
os module, 171-173
access function, 174
chdir function, 174
chmod function, 174
close function, 185
curdir attribute, 173
defpath attribute, 173
dup/dup2 functions, 185
environ attribute, 288
errno attribute, 172
execl function, 288
execle function, 288
execlp function, 288
execlv function, 288
execve function, 288
execvp function, 288
execvpe function, 288
extsep attribute, 173
fdopen function, 185
file descriptor operations, 184-186
file/directory functions, 174-177
filename attribute, 172
filesystem operations, 173-177
fstat function, 185
getcwd function, 175
linesep attribute, 173
listdir function, 175
lseek function, 185
makedirs function, 175
mkdir function, 175
name attribute, 172
O_APPEND attribute, 186
O_BINARY attribute, 186
O_CREAT attribute, 186
O_DSYNC attribute, 186
O_EXCL attribute, 186
O_NDELAY attribute, 186
O_NOCTTY attribute, 186
O_NONBLOCK attribute, 186
open function, 186
O_RDONLY attribute, 186
O_RDWR attribute, 186
O_RSYNC attribute, 186
OSError exceptions, 172
O_SYNC attribute, 186
O_TRUNC attribute, 186
O_WRONLY attribute, 186
pardir attribute, 173
pathsep attribute, 173
path-string attributes of, 173
pipe function, 186
P_NOWAIT attribute, 291
popen function, 289
popen2 function, 290
popen3 function, 290
popen4 function, 290
P_WAIT attribute, 291
read function, 186
remove function, 175
removedirs function, 175
rename/renames functions, 175
rmdir function, 176
running other programs, 288-292
sep attribute, 173
spawnv/spawnve functions, 291
stat function, 176
strerror attribute, 172
system function, 292
running other programs, 288
tempnam function, 176
tmpnam function, 176
unlink function, 175
utime function, 177
write function, 186
OS/2, installing Python, 17
OSError exceptions, 110, 176
os module, 172
os.path module
abspath function, 177
basename function, 177
commonprefix function, 177
dirname function, 177
exists function, 177
expandvars function, 177
getatime function, 178
getmtime function, 178
getsize function, 178
isabs function, 178
isdir function, 178
isfile function, 178
islink function, 178
ismount function, 178
join function, 178
normcase function, 179
normpath function, 179
split function, 179
splitdrive function, 179
splitext function, 179
walk function, 179
O_SYNC attribute (os module), 186
O_TRUNC attribute (os module), 186
outer attribute (ufunc object), 324
output method
Morsel object, 465
SimpleCookie object, 464
SmartCookie object, 464
OutputString method (Morsel object), 465
OverflowError exception, 110
overrideredirect method (Toplevel object), 342
ownerDocument method (Node object), 504
ownerElement attribute (Attr object), 504
O_WRONLY attribute (os module), 186
P[ Top ]
p command (pdb module), 387
pack function (struct module), 196
pack method (Widget object), 363
packages, 124
packages argument (distutils setup function), 563
pack_forget method (Widget object), 363
pack_info method (Widget object), 363
parameters, 60
paramstyle attribute (DBAPI-compliant modules), 238
pardir attribute (os module), 173
parent widgets, 329, 341
parentheses ( )
class statements, 71
def statement, 59
function calls, 62
line continuation, 30
plain assignment statements, 42
regular expressions, 157
string formatting, 152
tuple creation, 43
parentNode method (Node object), 504
parse function
minidom module, 502
pulldom module, 507
parseaddr function (Utils module), 479
parse_and_bind function (readline module), 207
parsedate function (Utils module), 479
parsedate_tz function (Utils module), 479
parser function (xml.sax package), 496
Parser module
message_from_file function, 472
message_from_string function, 472
parseString function
minidom module, 502
pulldom module, 507
xml.sax package, 497
pass_ method (POP3 object), 417
pass statement, 58
path attribute (sys module), 121, 139
path method (HTTPServer object), 440
path module, 177-180
PATH variable
lack of, 173
python interpreter and, 19
pathsep attribute (os module), 173
path-string attributes (os module), 173
pattern attribute (regular expression object), 163
PBF (Python Business Forum), 8
pdb module, 384-388
alias command, 385
args command, 385
break command, 385
clear command, 385
condition command, 385
continue command, 385
disable command, 385
down command, 386
enable command, 386
ignore command, 386
list command, 387
next command, 387
p command, 387
quit command, 387
return command, 387
step command, 387
tbreak command, 387
unalias command, 385
up command, 387
where command, 388
PEPs (Python Enhancement Proposals), 7
percent sign (%)
HTML templates, 490
remainder, 43
string formatting, 151
performance
arrays and, 296
asyncore/asynchat modules, 468
CGI scripts, 466
DBM modules, 232
extension modules, special-purpose, 5
fileinput module, 193
pickle/cPickle modules, 225
slicing array object, 307
supporting many Python versions and, 197
threads, 276
synchronizing, 281
Twisted package, 468
(see also optimization)
per-instance methods, 87
period (.)
attributes, 40
attribute reference, 43
instance objects, 74
current directory designation, 173
DOTALL attribute, 161
regular expressions, 157
string formatting, 152
permissions, 174
Personal Web Server (PWS), 461
pformat function (pprint module), 154
PhotoImage class, 335
pickle function (copy_reg module), 229
pickle module, 225-229
dump/dumps functions, 226
load/loads functions, 226
Pickler function, 227
pickling customization with copy_reg module, 228
Unpickler function, 227
Pickler function (pickle/cPickle modules), 227
PIL (Python Imaging Library), 335
pipe function (os module), 186
pkzip/pkunzip programs, 200
place method (Widget object), 365
place_forget method (Widget object), 365
place_info method (Widget object), 365
plain assignment statements, 41
platform attribute (sys module), 139
platforms argument (distutils setup function), 562
platforms, specifying, 172, 206
plus sign (+)
addition, 43
DateTime instances, 256
DateTimeDelta instances, 258
regular expressions, 157
sequence concatenation, 46
string formatting, 152
unary plus, 43
plus sign-question mark (+?), regular expressions, 157
P_NOWAIT attribute (os module), 291
polymorphism
file-like object and, 191
type checking and, 129
POP mailboxes, accessing, 417
pop method (list object), 49
POP3 class (poplib module), 417
dele method, 417
list method, 417
pass_ method, 417
quit method, 417
retr method, 417
set_debuglevel method, 417
stat method, 418
top method, 418
user method, 418
POP3 (Post Office Protocol Version 3), 416
twisted.protocols package, 450
popen function (os module), 289
popen2 function (os module), 290
popen3 function (os module), 290
popen4 function (os module), 290
popitem method (dictionary object), 50
poplib module, 407, 417
POP3 class, 417
portability
DBM modules, 232
distributing Python modules, 566
error code numbers, 172
extension modules and, 5
os module and, 171
platform-dependent errors, 110
Portable PixMap (PPM), 335
pos attribute (match object), 166
pos method (operator module), 300
_ _pos_ _ special method, 97
positional arguments, 63
post method
Menu object, 345
NNTP object, 426
Post Office Protocol Version 3 (see POP3)
postcmd function (cmd module), 214
PostgreSQL, 243
postloop function (cmd module), 214
pound sign (#)
comments, 29
regular expressions, 161
string formatting, 152
pow function
built-in, 135
cmath module, 298
math module, 298
pow function (built-in), 45
_ _pow_ _ special method, 99
PowerArchiver, uncompressing/unpacking, 13
PPM (Portable PixMap), 335
pprint function (pprint module), 154
pprint module, 153
pformat function, 154
pprint function, 154
prcal function (calendar module), 251
preamble attribute (Message object), 475
precmd function (cmd module), 214
prefix method (Node object), 504
preloop function (cmd module), 214
PrettyPrinter class, 153
previous function (bsddb module), 235
previousSibling method (Node object), 504
print statement, 204
printable attribute (string module), 150
print_callees method (Stats object), 398
print_callers method (Stats object), 398
printdir function (ZipFile class), 201
print_exc function (traceback module), 384
printing, complicated data in readable format, 153
print_stats method (Stats object), 398
prmonth function (calendar module), 251
process environment, 287
processes, 276
Profile class, 397
profile module, run function, 396
profiling, 140, 371
program termination, 273
programming paradigms, ability to mix and match in Python, 69
programs, running other, 288-292
prompt attribute (cmd module), 215
prompt string, Python interactive sessions, 22
prompt_user_passwd method (FancyURLopener object), 412
property type (built-in), 85, 128
Protocol class, 452
connectionLost method, 452
connectionMade method, 452
dataReceived method, 452
protocol method (Toplevel object), 343
protocol module
protocol handlers, 452
reactors object, 450
transports object, 451
proxy function (weakref module), 272
ProxyBasicAuthHandler class, 416
ProxyDigestAuthHandler class, 416
ps1, ps2 attribute (sys module), 139
pseudo-random numbers, 300
PSF (Python Software Foundation), 7
PSP (Python Server Pages), 467
embedding Python code in HTML, 490
pstats module, 397
psycopg module, 243
.pth files, module loading and, 121
PTL (Python Template Language), 467
pulldom module, 507
DOMEventStream class, 507
parse function, 507
parseString function, 507
parsing XHTML, 508
punctuation
in regular expressions, 157
in URLs, 407
punctuation attribute (string module), 150
pure distributions, 560
push method (async_chat object), 448
pushbutton widgets, 336
put function (Numeric module), 319
put method (Queue object), 279
putmask function (Numeric module), 319
put_nowait method (Queue object), 279
P_WAIT attribute (os module), 291
pwd method (FTP object), 421
PWS (Personal Web Server), 461
Py class (Jython API), 557
.py files, 24
py2exe tool, 568
PyApache, 467
PyArg_ParseTuple function (Python C API), 522
PyArg_ParseTupleAndKeywords function (Python C API), 524
Py_BuildValue function (Python C API), 524
.pyc files, 24
PyCallable_Check function (Python C API), 528
Py_CompileString function (Python C API), 549
PyDict_GetItem function (Python C API), 533
PyDict_GetItemString function (Python C API), 533
PyDict_Merge function (Python C API), 533
PyDict_MergeFromSeq2 function (Python C API), 533
PyDict_Next function (Python C API), 533
PyErr_Clear function (Python C API), 527
PyErr_ExceptionMatches function (Python C API), 527
PyErr_Format function (Python C API), 526
PyErr_NewException function (Python C API), 526
PyErr_NoMemory function (Python C API), 526
PyErr_Occurred function (Python C API), 527
PyErr_Print function (Python C API), 527
PyErr_SetFromErrno function (Python C API), 526
PyErr_SetFromErrnoWithFilename function (Python C API), 527
PyErr_SetObject function (Python C API), 526
PyEval_CallObject function (Python C API), 528
PyEval_CallObjectWithKeywords function (Python C API), 528
PyEval_EvalCode function (Python C API), 549
PyException exception, 556
Py_Finalize function (Python C API), 547
PyFloat_AS_DOUBLE function (Python C API), 534
Pyfort library, 545
PyImport_AppendInittab function (Python C API), 546
PyImport_Import function (Python C API), 519
Py_InitModule3 function (Python C API), 518
PyIter_Check function (Python C API), 528
PyIter_Next function (Python C API), 528
PyList_GET_ITEM function (Python C API), 534
PyList_New function (Python C API), 534
PyList_SET_ITEM function (Python C API), 534
PyModule_AddIntConstant function (Python C API), 518
PyModule_AddObject function (Python C API), 519
PyModule_AddStringConstant function (Python C API), 519
PyModule_GetDict function (Python C API), 519
PyModule_New function (Python C API), 548
py_modules argument (distutils setup function), 563
PyNumber_Absolute function (Python C API), 532
PyNumber_Add function (Python C API), 532
PyNumber_And function (Python C API), 532
PyNumber_Check function (Python C API), 528
PyNumber_Divide function (Python C API), 532
PyNumber_Divmod function (Python C API), 532
PyNumber_Float function (Python C API), 532
PyNumber_FloorDivide function (Python C API), 532
PyNumber_Int function (Python C API), 532
PyNumber_Invert function (Python C API), 532
PyNumber_Long function (Python C API), 532
PyNumber_Lshift function (Python C API), 532
PyNumber_Multiply function (Python C API), 532
PyNumber_Negative function (Python C API), 532
PyNumber_Or function (Python C API), 532
PyNumber_Positive function (Python C API), 532
PyNumber_Power function (Python C API), 532
PyNumber_Remainder function (Python C API), 532
PyNumber_Rshift function (Python C API), 532
PyNumber_Subtract function (Python C API), 532
PyNumber_TrueDivide function (Python C API), 532
PyNumber_Xor function (Python C API), 532
.pyo files, 24
PyObject class (Jython API), 556
PyObject object
_ _call_ _ method, 556
_ _tojava_ _ method, 556
PyObject_CallFunction function (Python C API), 529
PyObject_CallMethod function (Python C API), 529
PyObject_Cmp function (Python C API), 529
PyObject_DelAttrString function (Python C API), 529
PyObject_DelItem function (Python C API), 529
PyObject_DelItemString function (Python C API), 529
PyObject_GetAttrString function (Python C API), 529
PyObject_GetItem function (Python C API), 529
PyObject_GetItemString function (Python C API), 529
PyObject_GetIter function (Python C API), 529
PyObject_HasAttrString function (Python C API), 529
PyObject_IsTrue function (Python C API), 530
PyObject_Length function (Python C API), 530
PyObject_Repr function (Python C API), 530
PyObject_RichCompare function (Python C API), 530
PyObject_RichCompareBool function (Python C API), 530
PyObject_SetAttrString function (Python C API), 530
PyObject_SetItem function (Python C API), 530
PyObject_SetItemString function (Python C API), 530
PyObject_Str function (Python C API), 530
PyObject_Type function (Python C API), 530
PyObject_Unicode function (Python C API), 530
pyrepl package for Unix, 22
Pyrex, 545
PyRun_File function (Python C API), 548
PyRun_String function (Python C API), 548
pyRXP, 494
PySequence_Contains function (Python C API), 530
PySequence_DelSlice function (Python C API), 531
PySequence_Fast function (Python C API), 531
PySequence_Fast_GET_ITEM function (Python C API), 531
PySequence_Fast_GET_SIZE function (Python C API), 531
PySequence_GetSlice function (Python C API), 531
PySequence_List function (Python C API), 531
PySequence_SetSlice function (Python C API), 531
PySequence_Tuple function (Python C API), 531
Py_SetProgramName function (Python C API), 546
PyString_AS_STRING function (Python C API), 534
PyString_AsStringAndSize function (Python C API), 534
PyString_FromFormat function (Python C API), 534
PyString_FromStringAndSize function (Python C API), 534
PySys_SetArgv function (Python C API), 547
Python, 3-11
compiling into Java, 557-559
adding Java-visible methods, 558
jythonc command, 557
Python applets/servlets, 559
development, 7
development environments (see development environments)
documentation, 8
embedding in HTML, 490
embedding/extending (see CPython, extending)
extension modules (see extension modules; see also CPython)
extensions (see CPython, extending)
implementations, 5-7
installing (see installing)
interpreter, 19-22
command-line options, 20
command-line syntax, 20-22
environment variables, 19
interactive sessions, 22
prompt strings, specifying, 139
language, 3, 29-68
indentation, 30, 110
lexical structure, 29-33
library, 4
modules (see modules)
newsgroups/mailing lists, 9
object models, 69
classic, 70-81
new-style, 81-90
object-orientation, 69-103
(see also Python, object models)
programming paradigms, 69
programs
documenting, 115
running, 24
resources, 8-11
business uses of Python, 9
extension modules, 10
print, 10
Python Journal, 10
recipes, 10
source, 10
running other programs, 288-292
SIGs, 9
upgrades, overwriting customizations, 274
versions, 7
datetime module, 245
Forum releases, 8
logging, 380
Python-in-a-tie releases, 8
SimpleXMLRPCServer module, defect in, 442
sockets with timeout behavior, 437
supporting many different, 197
time module, 246, 248
type objects, 268
(see also CPython; Jython)
Python Business Forum (PBF), 8
Python C API, extending CPython with, 515-545
building/installing C-coded Python extensions, 516
Python Database API 2.0 standard (DBAPI 2.0), 223
Python Enhancement Proposals (PEPs), 7
Python Imaging Library (PIL), 335
Python Labs, Zope Corporation, 7
Python .NET, 6
Python Server Pages (PSP), 467
Python Software Foundation (PSF), 7
Python Template Language (PTL), 467
PYTHONHOME variable, 20
Python-in-a-tie releases, 8
PythonInterpreter class (Jython API), 554
eval method, 555
exec method, 555
execfile method, 555
get method, 555
set method, 555
PythonInterpreter icon (Macintosh), 20
python.path option, 551
PYTHONPATH variable, 20
module loading, 121
.pythonrc.py file, 275
PYTHONSTARTUP variable, 20
user customization and, 275
pythonw interpreter, 25
PythonWin, 23
PythonWorks, 23
PyTuple_GET_ITEM function (Python C API), 535
PyTuple_New function (Python C API), 534
PyTuple_SET_ITEM function (Python C API), 535
.pyw files, 25
PyXML, 494
Q[ Top ]
-Qnew switch, 45
QNX, installing Python, 17
QP encoding (Quoted Printable encoding), 470
qsize method (Queue object), 279
question mark (?), regular expressions, 157
Queue class (Queue module), 278
empty method, 278
full method, 278
get method, 278
get_nowait method, 278
put method, 279
put_nowait method, 279
qsize method, 279
in threaded program architecture, 284
Queue module, 278
Empty class, 278
Full class, 278
Queue class, 278
- -quiet option, package installation, 125
quit command (pdb module), 387
quit method
FTP object, 421
NNTP object, 426
POP3 object, 417
SMTP object, 418
Widget object, 333
Quixote, 467
quopri module, 470
decode function, 470
decodestring function, 470
encode function, 470
encodestring function, 471
quote function
urllib module, 410
Utils module, 479
quoteattr function (saxutils module), 499
Quoted Printable encoding (QP encoding), 470
quoted strings, 35
quote_plus function (urllib module), 410
R[ Top ]
_ _radd_ _ special method, 99
r_add_module method (RExec object), 263
Radiobutton class (Tkinter module), 339
deselect method, 339
flash method, 339
invoke method, 340
select method, 340
raise statement, 108
_ _rand_ _ special method, 99
Random class, 300
choice method, 300
getstate method, 300
jumpahead method, 301
random method, 301
randrange method, 301
seed method, 301
setstate method, 301
shuffle method, 301
uniform method, 301
random method (Random object), 301
random module, 300
RandomArray module, 327
randrange method (Random object), 301
range function (built-in), 55, 135
rank function (Numeric module), 320
ravel function (Numeric module), 320
raw strings, 36
raw_input function (built-in), 135, 205
RDBMS (relational database management system), 223
RDF (Resource Description Framework), 494
_ _rdiv_ _ special method, 99
_ _rdivmod_ _ special method, 99
re attribute (match object), 167
re module, 156, 168
compile function, 156, 168
flags argument, 161
DOTALL attribute, 161
escape function, 168
IGNORECASE attribute, 161
LOCALE attribute, 161
MULTILINE attribute, 161
UNICODE attribute, 161
VERBOSE attribute, 161
reactor object
callLater method, 451
cancelCallLater method, 451
listenTCP method, 451
run method, 451
stop method, 451
read function
os module, 186
ZipFile class, 201
read method
file object, 190
HTTPResponse object, 419
mmap object, 293
URL file-like object, 411
read_all method (Telnet object), 428
read_byte method (mmap object), 294
read_eager method (Telnet object), 428
read_history_file function (readline module), 207
read_init_file function (readline module), 207
readline method
file object, 190
mmap object, 294
URL file-like object, 411
readline module, 206-207
get_history_length function, 207
parse_and_bind function, 207
read_history_file function, 207
read_init_file function, 207
set_completer function, 207
set_history_length function, 207
write_history_file function, 207
ReadLine package for Windows, 22
readlines method
file object, 190
URL file-like object, 411
read-only file mode, 187
read_some method (Telnet object), 428
read_until method (Telnet object), 428
real method (array object), 312
reason method (HTTPResponse object), 420
rebinding, references, 150
recursion, 68
RecursionLimitExceeded exception, 68
recv method (socket object), 434
recvfrom method (socket object), 434
RedHat Package Manager (RPM), 16
reduce attribute (ufunc object), 324
reduce function (built-in), 135
reduceat attribute (ufunc object), 324
ref function (weakref module), 272
references, 39-43
accessing nonexistent, 40
assignment statements, 40-42
binding, 39
failure of, 110
rebinding, 39
reference counting, C-coded extension modules, 520
reference loops, 272
unbinding, 39, 42
weak, 272
(see also attributes; variables)
refresh method (Window object), 209
register function (atexit module), 274
register_function method
SimpleXMLRPCServer object, 442
register_instance method
SimpleXMLRPCServer object, 442
regular expression object, 163-166
attributes, 163
findall method, 163
match method, 164, 166
search method, 164, 166
split method, 164
sub method, 165
subn method, 166
regular expressions, 156-168
alternatives, 160
anchoring at string start/end, 162
common idioms, 158
groups, 160
match object, 166-168
matching vs. searching, 162
optional flags, 161
pattern-string syntax, 157
re module, 168
sets of characters, 159
whitespace, 161
relational database management system (RDBMS), 223
RelativeDateTime type, 252
release method
Condition class, 282
lock object, 278
Semaphore object, 284
reload function (built-in), 122, 136
Remote Procedure Call (RPCs), 428
remove function (os module), 175
remove method (list object), 49
removeAttribute method (Element object), 509
removeChild method (Node object), 510
removedirs function (os module), 175
rename method (FTP object), 421
rename/renames functions (os module), 175
repeat function (Numeric module), 320
repeat method (operator module), 300
replace method (string object), 148
replaceChild method (Node object), 510
report_unbalanced method (sgmllib module), 483
Repr class (repr module), 154
repr function
built-in, 136
alternative to, 154
repr module, 154
_ _repr_ _ method (object type), 82
repr module, 154
Repr class, 154
repr function, 154
_ _repr_ _ special method, 94
Request class, 414
add_data method, 414
add_header method, 414
get_data method, 415
get_full_url method, 415
get_host method, 415
get_selector method, 415
get_type method, 415
has_data method, 415
set_proxy method, 415
request method
BaseRequestHandler object, 439
HTTPConnection object, 420
reset method (XMLReader object), 499
resetlocale function (locale module), 219
resetwarnings function (warnings module), 390
reshape function (Numeric module), 320
resizable method (Toplevel object), 343
resize function (Numeric module), 320
resize method (mmap object), 294
Resource Description Framework (RDF), 494
resources, 8-11
extension modules, 10
PBF, 9
print, 10
Python Cookbook, 10
Python Journal, 10
Python on Windows, 237
Python source code, 10
restricted execution, 262-268
exec statement and, 261
rexec module, 262-266
sandbox environment, 263
retr method (POP3 object), 417
retrbinary method (FTP object), 421
retrlines method (FTP object), 422
return command (pdb module), 387
return statement, 62
r_eval method (RExec object), 264
reverse method (list object), 49
RExec class, 263
nok_builtin_names attributes, 265
ok_builtin_modules attributes, 265
ok_path attributes, 265
ok_posix attributes, 265
ok_sys_names attributes, 265
r_add_module method, 263
r_eval method, 264
r_exec method, 264
r_execfile method, 264
r_import method, 264
r_open method, 264
r_reload method, 264
r_unload method, 264
s_eval method, 264
s_exec method, 264
s_execfile method, 264
s_import method, 264
s_reload method, 264
s_unload method, 264
r_exec method (RExec object), 264
rexec module, 262-266
r_execfile method (RExec object), 264
rfc822 module, Message class, 479
rfile method (HTTPServer object), 441
rfind method (string object), 148
richer-text input/output, 206-212
console I/O, 208-212
Console module, 212
curses package, 208-211
msvcrt module, 211
WConio module, 212
readline module, 206-207
r_import method (RExec object), 264
rindex method (string object), 148
RISC OS, installing Python, 17
rjust method (string object), 148
rlcompleter module, 207
RLock class (threading module), 279, 281
_ _rlshift_ _ special method, 99
rmd method (FTP object), 422
rmdir function (os module), 176
_ _rmod_ _ special method, 99
rmtree function (shutil module), 184
_ _rmul_ _ special method, 99
rnopen function (bsddb module), 234
rollback method (Connection object), 241
r_open method (RExec object), 264
_ _ror_ _ special method, 99
round function (built-in), 136
rowcount attribute (Cursor object), 242
RPCs (Remote Procedure Calls), 428
RPM (RedHat Package Manager), 16
installing Python from binaries, 17
_ _rpow_ _ special method, 99
r_reload method (RExec object), 264
_ _rrshift_ _ special method, 99
rshift method (operator module), 300
_ _rshift_ _ special method, 98
rstrip method (string object), 148
_ _rsub_ _ special method, 99
run function, profile module, 396
run method
reactor object, 451
scheduler object, 250
Thread object, 281
r_unload method (RExec object), 264
runtime_library_dirs argument (distutils Extension class), 567
RuntimeWarning class, 389
_ _rxor_ _ special method, 99
S[ Top ]
sandbox environment, restricted execution, 263
SAP DB, 244
sapdbapi module, 244
Saturday attribute (mx.DateTime module), 259
save_bgn method (HTMLParser object), 486
save_end method (HTMLParser object), 486
savespace method (array object), 313
SAX (Simple API for XML)
parsing XHTML, 500
parsing XML, 496-500
(see also xml.sax package)
SAXException class (xml.sax package), 496
saxutils module, 499
escape function, 499
quoteattr function, 499
XMLGenerator class, 500
Scale class (Tkinter module), 340
get method, 340
set method, 340
sched module, 249
event scheduler function, 249
scheduler class, 249
cancel method, 249
empty method, 249
enter method, 250
enterabs method, 250
run method, 250
scheduler function (sched module), 249
SciTE program, 24
scripts, 24
CGI, 442
debugging, 459
performance characteristics, 466
Python, installing, 461
GUI, running standalone, 329
setup.py, 561
(see also server-side scripting)
scripts argument (distutils setup function), 564
Scrollbar class (Tkinter module), 340
SCXX library, 545
search method
regular expression object, 164, 166
Text object, 348
searchsorted function (Numeric module), 320
second attribute
DateTime class, 256
DateTimeDelta class, 258
seconds attribute (DateTimeDelta class), 258
Secret Labs, Python IDE offered by, 23
security
cookies and, 462
cryptographic-quality pseudo-random numbers, 300
denial-of-service attacks, 263
eval function, 205
isolating untrusted code, 262
passwords, 205
pickle/cPickle modules, 225
see method (Text object), 348
seed method (Random object), 301
seek method
file object, 190
mmap object, 294
select function (select module), 444
select method
Checkbutton object, 337
Radiobutton object, 340
select module, 443-445
select function, 444
select_clear method (Listbox object), 339
select_set method (Listbox object), 339
self parameter, 72, 77
Semaphore class (threading module), 279, 283, 284
acquire method, 284
release method, 284
semicolon (;)
statement separators, 32
Windows directory paths, 20
send method (socket object), 435
sendall method (socket object), 435
sendcmd method (FTP object), 422
send_error method (HTTPServer object), 441
send_header method (HTTPServer object), 441
sendmail method (SMTP object), 418
send_response method (HTTPServer object), 441
sendto method (socket object), 435
sep attribute (os module), 173
September attribute (mx.DateTime module), 259
sequence repetition, 46
sequences, 34-37
comprehensions, 56
immutable, strings as, 145
indexing, error, 110
inserting items, 143
items in arithmetic progression, 137
iterators, 55
lists, 37
methods, 49
operations on, 48
mutable, 143
arrays, 302
operations on, 46-49
coercion/conversions, 46
concatenation, 46
indexing, 47
slicing, 47
reducing to single value, 135
special methods for, 95
strings, 35
methods, 145-149
operations on, 47
raw strings, 36
Unicode strings, 36
tuples, 36
operations on, 48
serialization, 223, 224-230
marshal module, 224
pickle/cPickle modules, 225-229
customization with copy_reg module, 228
shelve module, 229
serve_forever method (server object), 439
server method (BaseRequestHandler object), 439
server object, serve_forever method, 439
ServerProxy class, 429
listMethods method, 430
methodHelp method, 430
methodSignature method, 430
xmlrpclib module, 430
servers, 407
Apache
FastCGI for, 466
installing Python CGI scripts, 461
PyApache/mod_python for, 467
custom Python, 468
FTP, 420
HTTP, 419
methods/attributes, 440
sockets and, 440
Internet, 438-443
Microsoft web, installing Python CGI scripts on, 461
SMTP, 418
TCP echo, 435
Telnet, 427
UDP echo, 436
web, subclassing BaseHTTPServer, 468
Xitami
installing Python CGI scripts on, 462
LRWP for, 466
XML-RPC, 429
server-side scripting, 466-468
ASP, 466
custom Python servers, 468
FastCGI, 466
LRWP, 466
PyApache/mod_python, 467
Quixote, 467
Webware, 467
servlets, Jython, 559
set method
Event object, 283
Morsel object, 465
PythonInterpreter object, 555
Scale object, 340
setattr function (built-in), 136
_ _setattr_ _ special method, 82, 94
setAttribute method (Element object), 509
set_boundary method (Message object), 475
set_completer function (readline module), 207
setDaemon method (Thread object), 280
set_debug function (gc module), 270
set_debuglevel method (POP3 object), 417
setdefault method (dictionary object), 50
setdefaultencoding function (sys module), 140
setDefaultSocketTimeout function (timeoutsocket module), 438
setfirstweekday function (calendar module), 251
set_history_length function (readline module), 207
setitem method (operator module), 300
_ _setitem_ _ special method, 97
setlocale function (locale module), 219
set_location function (bsddb module), 235
setName method (Thread object), 280
set_pasv method (FTP object), 422
set_payload method (Message object), 475
setprofile function (sys module), 140
set_proxy method (Request object), 415
setrecursionlimit function (sys module), 68, 140
sets, special methods for, 95
setslice method (operator module), 300
setstate method (Random object), 301
set_terminator method (async_chat object), 449
set_threshold function (gc module), 271
set_timeout method (TimeoutSocket object), 438
settrace function (sys module), 140
set_unixfrom method (Message object), 475
setup function (distutils module), 561
setUp method (TestCase object), 379
setup.cfg file, 567
setup.py script, 125
s_eval method (RExec object), 264
s_exec method (RExec object), 264
s_execfile method (RExec object), 264
SGML (Standard General Markup Language), 481
sgmllib module, 481-485
close method, 482
do_tag method, 482
end_tag method, 482
feed method, 482
handle_charref method, 482
handle_comment method, 483
handle_data method, 483
handle_endtag method, 483
handle_entityref method, 483
handle_starttag method, 483
report_unbalanced method, 483
SGMLParser class, 482
start_tag method, 484
unknown_charref method, 484
unknown_endtag method, 484
unknown_entityref method, 484
unknown_starttag method, 484
SGMLParser class
HTMLParser class, compared to, 488
sgmllib module, 482
shape attribute (Numeric module), 305
shape function (Numeric module), 321
shape method (array object), 313
Sharp Zaurus, installing Python, 17
shelve module, 229
showwarning function (warnings module), 390
shuffle method (Random object), 301
shutil module, 183
copy function, 183
copy2 function, 183
copyfile function, 183
copyfileobj function, 184
copymode function, 184
copystat function, 184
copytree function, 184
rmtree function, 184
S_IFMT function (stat module), 181
SIGs (Special Interest Groups), 9
S_IMODE function (stat module), 181
Simple API for XML (see SAX)
Simple Mail Transport Protocol (see SMTP)
simple statements, 32
SimpleCookie class (Cookie module), 463
is_output method, 464
load method, 464
output method, 464
SimpleHTTPServer module, 440, 441
SimpleXMLRPCServer class, 442
register_function method, 442
register_instance method, 442
SimpleXMLRPCServer module, 440, 442
Simplified Wrapper and Interface Generator (SWIG), 545
s_import method (RExec object), 264
sin function
cmath module, 299
math module, 299
single quote ('), 35
sinh function
cmath module, 299
math module, 299
S_ISBLK function (stat module), 181
S_ISCHR function (stat module), 181
S_ISDIR function (stat module), 181
S_ISFIFO function (stat module), 181
S_ISLNK function (stat module), 181
S_ISREG function (stat module), 181
S_ISSOCK function (stat module), 181
site customization, 274
site module, 274
sitecustomize module, 155, 274
site.py file, 274
size function (Numeric module), 321
size method
FTP object, 422
mmap object, 294
sleep function (time module), 247
slice function (built-in), 136
slice object, 95
slicing
array object, 307-309
sequences, 47
targets, 41
_ _slots_ _ attribute, 86
SmartCookie class (Cookie module), 463
is_output method, 464
load method, 464
output method, 464
SMTP class, 418
connect method, 418
login method, 418
quit method, 418
sendmail method, 418
SMTP (Simple Mail Transport Protocol), 416
servers, 418
twisted.protocols package, 450
smtplib module, 407, 418
.so files, 515
socket class, 433
accept method, 433
bind method, 434
close method, 434
connect method, 432, 434
getpeername method, 434
listen method, 434
makefile method, 434
recv method, 434
recvfrom method, 434
send method, 435
sendall method, 435
sendto method, 435
socket function (socket module), 433
socket module, 431-438
getfqdn function, 432
gethostbyaddr function, 432
gethostbyname_ex function, 432
htonl/htons functions, 432, 433
inet_aton function, 433
inet_ntoa function, 433
socket class, 433
socket function, 433
sockets, 431-453
event-driven programs, 443-453
asynchat module, 448
asyncore module, 446
select module, 443-445
Twisted package, 450-453
HTTP servers, 440
BaseHTTPServer module, 440
GCIHTTPServer module, 442
SimpleHTTPServer module, 441
SimpleXMLRPCServer module, 442
TCP echo servers, 435
timeoutsocket module, 437
UDP echo servers, 436
(see also socket module)
SocketServer module, 438-443
BaseRequestHandler class, 439
softspace attribute (file object), 190
Solaris, Python IDEs, 23
Sony PlayStation 2, installing Python, 17
sort function (Numeric module), 321
sort method (list object), 49
sort_stats method (Stats object), 398
source code
building with Visual C++, 12
for debugging, 14
installing from, 12-16
on Macintosh, 16
on Unix, 15
on Windows, 13-15
latest version, 12
resources for further information, 10
uncompressing/unpacking, 13
source files, 116
as modules, 117
Python modules in distribution utilities, 563
(see also modules)
Source Navigator (Red Hat), 23
spacesaver method (array object), 313
span method (match object), 167
spawnv/spawnve functions (os module), 291
Special Interest Groups (SIGs), 9
special methods, 90-99
_ _abs_ _, 97
_ _dd_ _, 97
_ _and_ _, 98
_ _call_ _, 91
_ _cmp_ _, 91
_ _coerce_ _, 98
_ _complex_ _, 98
for containers, 94-97
_ _del_ _, 91
_ _delattr_ _, 82, 92
_ _div_ _, 97
_ _divmod_ _, 98
_ _eq_ _, 92
_ _float_ _, 98
_ _floordiv_ _, 97
_ _ge_ _, 92
general purpose, 90-94
_ _getattr_ _, 92
_ _getattribute_ _, 82, 86, 92
_ _getinitargs_ _, 228
_ _gt_ _, 92
_ _hash_ _, 82, 93
_ _hex_ _, 98
_ _iadd_ _, 98
_ _iand_ _, 99
_ _idiv_ _, 98
_ _ifloordiv_ _, 98
_ _ilshift_ _, 99
_ _imod_ _, 98
_ _imul_ _, 98
_ _init_ _, 73, 83, 93
_ _int_ _, 98
_ _invert_ _, 97
_ _ior_ _, 99
_ _ipow_ _, 99
_ _irshift_ _, 99
_ _isub_ _, 98
_ _itruediv_ _, 98
_ _ixor_ _, 99
_ _le_ _, 92
_ _long_ _, 98
_ _lshift_ _, 98
_ _lt_ _, 92
_ _mod_ _, 97
_ _mul_ _, 97
_ _ne_ _, 92
_ _neg_ _, 97
_ _new_ _, 82, 84, 93
_ _nonzero_ _, 93
for numeric objects, 97-99
_ _oct_ _, 98
_ _or_ _, 98
_ _pos_ _, 97
_ _pow_ _, 99
_ _radd_ _, 99
_ _rand_ _, 99
_ _rdiv_ _, 99
_ _rdivmod_ _, 99
_ _repr_ _, 94
_ _rlshift_ _, 99
_ _rmod_ _, 99
_ _rmul_ _, 99
_ _ror_ _, 99
_ _rpow_ _, 99
_ _rrshift_ _, 99
_ _rshift_ _, 98
_ _rsub_ _, 99
_ _rxor_ _, 99
_ _setattr_ _, 82, 94
_ _str_ _, 82, 94
_ _sub_ _, 97
_ _unicode_ _, 94
_ _xor_ _, 98
specified attribute (Attr object), 504
split function (os.path module), 179
split method
regular expression object, 164
string object, 148
splitdrive function (os.path module), 179
splitext function (os.path module), 179
splitlines method (string object), 148
Spyce, 490
Cheetah and, 491
SQL (Structured Query Language), 223
executing SQL statements, 242
sqrt function
cmath module, 299
math module, 299
square brackets ([ ])
indexing, 43
item indexes, 40
line continuation, 30
list creation, 43
lists, 37
plain assignment statements, 42
python command-line syntax, 20
regular expressions, 157, 159
slicing, 43
s_reload method (RExec object), 264
stack function (inspect module), 383
standard error, 204
Standard General Markup Language (SGML), 481
standard input, 205
standard output, 204
writing prompt to, 135
StandardError exception, 109
start method
match object, 167
Thread object, 281
startDocument method, ContentHandler object, 497
startElement method, ContentHandler object, 498
startElementNS method, ContentHandler object, 498
startswith method (string object), 148
start_tag method
HTMLParser object, 485
sgmllib module, 484
stat function (os module), 176
stat method
NNTP object, 426
POP3 object, 418
stat module
attributes, 180
functions, 181
state method (Toplevel object), 343
statements
assigning values to variables (see assignment statements)
compound, 33
simple, 32
SQL, executing, 242
static methods, 82
staticmethod type (built-in), 82, 128
ST_ATIME attribute (stat module), 180
Stats class, 397
add method, 398
print_callees method, 398
print_callers method, 398
print_stats method, 398
sort_stats method, 398
strip_dirs method, 399
status method (HTTPResponse object), 420
ST_CTIME attribute (stat module), 180
stderr attribute (sys module), 114, 140
ST_DEV attribute (stat module), 180
stdin attribute (sys module), 140, 205
stdout attribute (sys module), 140
step command (pdb module), 387
ST_GID attribute (stat module), 180
ST_INO attribute (stat module), 180
ST_MODE attribute (stat module), 180
ST_MTIME attribute (stat module), 180
ST_NLINK attribute (stat module), 180
stop method (reactor object), 451
StopIteration exception, 55
storbinary method (FTP object), 422
storlines method (FTP object), 422
_ _str_ _ special method, 82, 94
str type (built-in), 47, 128, 145-149
date/time string conversions, 252
locale module, 219
strcoll function (locale module), 219
streams, 140
strerror attribute (os module), 172
strftime function (time module), 247
fine-grained string formatting, 252
strftime method
DateTime class, 255
DateTimeDelta class, 258
string attribute (match object), 167
string module, 149-151
ascii_letters attribute, 149
ascii_lowercase attribute, 149
ascii_uppercase attribute, 149
digits attribute, 149
hexdigits attribute, 149
letters attribute, 149
locale sensitivity (see locale module)
lowercase attribute, 149
maketrans function, 150
octdigits attribute, 150
printable attribute, 150
punctuation attribute, 150
uppercase attribute, 150
whitespace attribute, 150
string object
capitalize method, 145
center method, 145
count method, 146
encode method, 146
endswith method, 146
expandtabs method, 146
find method, 146
index method, 146
isalnum method, 146
isalpha method, 146
isdigit method, 146
islower method, 147
isspace method, 147
istitle method, 147
isupper method, 147
join method, 147
ljust method, 147
lower method, 147
lstrip method, 147
methods of, 145-149
replace method, 148
rfind method, 148
rindex method, 148
rjust method, 148
rstrip method, 148
split method, 148
splitlines method, 148
startswith method, 148
strip method, 148
swapcase method, 149
title method, 149
translate method, 149
upper method, 149
StringIO module, 197
strings, 35
case sensitivity, 147
concatenating, 147
converting, 127
date/time types, 252
to floating-point numbers, 127
to Unicode, 154
denoting current directory, 173
escape sequences, table of, 35
formatting, 151-153
common idioms, 153
conversion characters, 151
format specifier syntax, 152
hexadecimal, converting integers, 133
as immutable sequences, 145
interned, 133
line termination, 173
methods, 145-149
mmap object and, 292
mutable, 143
occurrences of, returning, 146
octal, converting integers to, 135
optimizing operations on, 395
raw strings, 36
searching, 146
sequence operations on, 47
sorting, internationalization and, 216
Unicode strings, 36
Unicode, Tkinter and, 329
whitespace in, 147
strip method (string object), 148
strip_dirs method (Stats object), 399
strptime function (time module), 248
struct module, 195
calcsize function, 196
format characters, 196
pack function, 196
Structured Query Language (see SQL)
strxfrm function (locale module), 219
ST_SIZE attribute (stat module), 180
ST_UID attribute (stat module), 180
sub method
operator module, 300
regular expression object, 165
_ _sub_ _ special method, 97
subclass relationships, 70
subn method (regular expression object), 166
Sunday attribute (mx.DateTime module), 259
s_unload method (RExec object), 264
super type (built-in), 89, 128
superclass methods, delegating to, 80
SUSE, installing Python, 17
swapaxes function (Numeric module), 321
swapcase method (string object), 149
SWIG (Simplified Wrapper and Interface Generator), 545
SynEdit program, 24
SyntaxError exception, 110
SyntaxWarning exception, 389
sys module
argv attribute, 137
attributes, 137-141
displayhook function, 138
excepthook function, 114, 138
exc_info function, 112, 138
exit function, 109, 138
getdefaultencoding function, 139
_getframe function, 139, 268
getrecursionlimit function, 139
getrefcount function, 139, 269
maxint attribute, 139
module loading, 120
modules attribute, 120, 139
_ _import_ _ function and, 123
path attribute, 121, 139
platform attribute, 139
ps1, ps2 attribute, 139
setdefaultencoding function, 140
setprofile function, 140
setrecursionlimit function, 68, 140
settrace function, 140
stderr attribute, 114, 140
stdin attribute, 140, 205
stdout attribute, 140
tracebacklimit attribute, 140
version attribute, 141
sys.excepthook file, 107
sys.stderr file, 107
system function (os module), 292
running other programs, 288
system testing, 371
SystemError exception, 111
SystemExit exception, 109, 138
T[ Top ]
tabs, converting to spaces, 146
tag_add method (Text object), 350
tag_bind method
Canvas object, 357
Text object, 350
tag_cget method (Text object), 350
tag_config method (Text object), 351
tag_delete method (Text object), 351
tag_lower method (Text object), 352
tag_names method (Text object), 352
tag_raise method (Text object), 352
tag_ranges method (Text object), 352
tag_remove method (Text object), 352
tags
HTML, 483
HTML v2.0, 485
tag_unbind method
Canvas object, 358
Text object, 352
take function (Numeric module), 321
tan function
cmath module, 299
math module, 299
tar program, 13
targets of assignments, 41, 54
tbreak command (pdb module), 387
TCP echo servers, 435
TCPServer class, 438
tearDown method (TestCase object), 379
tell method
file object, 191
mmap object, 294
Telnet class, 427
close method, 427
expect method, 427
interact method, 428
open method, 428
read_all method, 428
read_eager method, 428
read_some method, 428
read_until method, 428
write method, 428
telnet protocol, 407, 427
twisted.protcols package, 450
Telnet servers, 427
telnetlib module, 291, 407, 427
Template class (Cheetah.Template module), 492
Template module (Cheetah package), 492
tempnam function (os module), 176
termination functions, 273
TestCase class
assert_ method, 378
assertEqual method, 379
assertNotEqual method, 379
assertRaises method, 379
fail method, 379
failIf method, 379
failIfEqual method, 379
failUnless method, 378
failUnlessEqual method, 379
failUnlessRaises method, 379
setUp method, 379
tearDown method, 379
unittest module, 378
test-first coding, 372
testing, 371, 371-380
doctest module, 373-376
system testing, 371
unit testing, 371
large amounts of data, 379
unittest module, 376-378
testzip function (ZipFile class), 202
Text class (Tkinter module), 347
compare method, 353
delete method, 347
get method, 347
image_create method, 347
index method, 353
insert method, 347
mark_gravity method, 349
mark_set method, 350
mark_unset method, 350
search method, 348
see method, 348
tag_add method, 350
tag_bind method, 350
tag_cget method, 350
tag_config method, 351
tag_delete method, 351
tag_lower method, 352
tag_names method, 352
tag_raise method, 352
tag_ranges method, 352
tag_remove method, 352
tag_unbind method, 352
window_create method, 348
xview method, 348
yview method, 348
text editors with Python support, 24
text files, 171
text file mode, 188
text input/output, 204-206
getpass module, 205
input (built-in function), 133, 205
print statement, 204
raw-input (built-in function), 135, 205
standard input, 205
standard output/standard error, 204
text widgets, 347-356
coupling with scrollbars, 349
fonts, 354
indices, 352
marks on, 349
tags on, 350
Textpad class (textpad module), 210
textpad module
edit function, 211
Textpad class, 210
.tgz file extension, 12
theKompany, Python IDE offered by, 23
Thread class (threading module), 280
getName method, 280
isAlive method, 280
isDaemon method, 280
join method, 280
run method, 281
setDaemon method, 280
setName method, 280
start method, 281
thread module, 277
threaded program architecture, 284-287
polling, 287
thread pool, 285
threading module, 279-284
Condition class, 279, 282
currentThread function, 279
Event class, 279, 283
RLock class, 279
Semaphore class, 279, 284
Thread class, 280
Thread object, 280
thread synchronization, 281-284
Condition class, 282
Event object, 283
Lock/RLock objects, 281
Semaphore object, 283
ThreadingTCPServer class, 439
ThreadingUDPServer class, 439
threads, 276-284
locks, 277
multithreaded access, 278
Queue module, 278
suspending, 247
synchronizing, 281-284
Condition class, 282
Event object, 283
Lock/RLock objects, 281
Semaphore object, 283
thread safety, DBAPI, 237
(see also threaded program architecture; threading module)
Thursday attribute (mx.DateTime module), 259
ticks method (DateTime class), 255
tilde (~), bitwise NOT, 43
Time function (DBAPI-compliant modules), 239
time function (time module), 249
time module, 245-249
asctime function, 246
clock function, 246
ctime function, 247
functions
Python v2.2 and, 246
gmtime function, 247
localtime function, 247
mktime function, 247
sleep function, 247
strftime function, 247
fine-grained string formatting, 252
strptime function, 248
time function, 249
timezone attribute, 249
tzname attribute, 249
time operations, 245-259
local time zone, retrieving, 249
time-tuple, 245
(see also time module; time/date values)
time/date values
compressed files, 200
computing moveable feast days, 259
converting, 248
current CPU time, retrieving, 246
directory paths, 177
internationalization and, 216
in ISO 8601, 259
time-tuple, 245
TimeDelta function (DateTimeDelta class), 257
TimeDeltaFrom function (DateTimeDelta class), 257
TimeFromTicks function (DateTimeDelta class), 257
TimeFromTicks function (DBAPI-compliant modules), 239
timegm function (calendar module), 251
timeoutsocket module, 437
getDefaultSocketTimeout function, 438
setDefaultSocketTimeout function, 438
TimeoutSocket object
get_timeout method, 438
set_timeout method, 438
Timestamp function
DBAPI-compliant modules, 239
mx.DateTime module, 253
TimestampFrom function (mx.DateTime module), 253
TimestampFromTicks function
DBAPI-compliant modules, 239
mx.DateTime module, 254
time-tuple, 245
timezone attribute (time module), 249
title method
string object, 149
Toplevel object, 343
tkFont module, 354
Tkinter events, 365-369
binding callbacks to events, 366
Event object, 366
keyboard, 366
methods related to, 367
mouse, 367
Tkinter GUIs, 328-370
Tkinter module, 329
attributes, 330
Button class, 336
Canvas class, 356
Checkbutton class, 336
Entry class, 337
Event class, 366
events (see Tkinter events)
Frame class, 341
geometry management, 362-365
the Gridder, 363
the Packer, 362
the Placer, 364
images, 335
Label class, 338
Listbox class, 338
Menu class, 344
Radiobutton class, 339
Scale class, 340
Scrollbar class, 340
Text class, 347
Toplevel class, 341
variable object, 334
widgets supplied by, 336-360
options, 330-332
tmpnam function (os module), 176
today function (mx.DateTime module), 254
tofile method (array object), 303
toggle method (Checkbutton object), 337
_ _tojava_ _ method (PyObject object), 556
tokens, 30-32
delimiters, 31
identifiers, 30
keywords, 31
literals, 32
operators, 31
tolist method, array object, 303, 313
toolkits, 328
top method (POP3 object), 418
Toplevel class (Tkinter module), 341
deiconify method, 342
geometry method, 342
iconify method, 342
maxsize method, 342
minsize method, 342
overrideredirect method, 342
protocol method, 343
resizable method, 343
state method, 343
title method, 343
withdraw method, 343
toprettyxml method (Node object), 510
tostring method (array object), 303, 314
toxml method (Node object), 510
trace function (Numeric module), 322
traceback messages, 104
traceback module, 268
print_exc function, 384
tracebacklimit attribute (sys module), 140
translate method (string object), 149
translation function (gettext module), 221
translation tables, building, 149
transports object
getHost method, 451
getPeer method, 452
loseConnection method, 452
write method, 452
transpose function (Numeric module), 322
troubleshooting
error-specific information, 109
memory leaks, 269
truncate method (file object), 191
truncating division, performing true division on integers, 45
truth method (operator module), 300
try statement, 58
exception handling, 104-107
try/except form, 105-106, 113
try/finally form, 106
try/except form, running restricted code in, 262
Tuesday attribute (mx.DateTime module), 259
tuple method
DateTime class, 255
DateTimeDelta class, 258
tuple type (built-in), 48, 128
tuples, 36
returning list of, 137
sequence operations on, 48
in string formats, 153
Twisted package, 443, 450-453
performance characteristics, 468
twisted.internet/twisted.protocols packages, 450
twisted.internet package, 450
twisted.protocols package, 450
type attribute (FieldStorage object), 457
type checking, 129
type codes
array module, 302
Numeric arrays, 304
type type (built-in), 100, 129, 268
typecode method (array object), 314
TypeError exception, 111, 172
type_option attribute (FieldStorage object), 457
types
built-in, 126-129
defining new with C-coded Python extensions, 538
internal, 268
type object, 268
types module, 268
DictionaryType attribute, 268
DictType attribute, 268
tzname attribute (time module), 249
U[ Top ]
UDP echo servers, 436
UDPServer class, 438
ufunc object
accumulate attribute, 324
attributes, 323
outer attribute, 324
reduce attribute, 324
reduceat attribute, 324
ufuncs (universal functions), Numeric module, 322-323
unalias command (pdb module), 385
unbind method (Widget object), 368
unbind_all method (Widget object), 368
unbinding (see references, unbinding)
unbound methods, 77-79
(see also methods)
UnboundLocalError exception, 111
undef_macros argument (distutils Extension class), 567
underscore (_)
class-private variables, 73
gettext module, 220
identifiers, 30, 119
interactive sessions, 22
module-private variables, 119
special methods, 70
ungetch function (msvcrt module), 211
unichr function (built-in), 137
Unicode
alphanumeric designation, 161
converting strings to, 154
UNICODE attribute (re module), 161
Unicode Character Database, 156
_ _unicode_ _ special method, 94
Unicode strings, 36, 154-156
codecs module, 155
encoding/decoding, 139
as immutable sequences, 145
Tkinter and, 329
unicode type (built-in), 47, 129, 145-149, 154
unicodedata module, 156
UnicodeError exception, 111
uniform method (Random object), 301
Uniform Resource Locators (see URLs)
unit testing, 371
large amounts of data, 379
unittest module, 376-378
TestCase class, 378
universal newlines, 188
Unix
binary/text file modes, 188
dbm module, 232
installing Python from source, 15
mmap function, 293
permission bits, 174
copying, 184
Python IDEs, 23
running Python scripts, 25
text editors with Python support, 24
Unix-to-Unix (UU) encoding, 471
unknown_charref method (sgmllib module), 484
unknown_endtag method (sgmllib module), 484
unknown_entityref method (sgmllib module), 484
unknown_starttag method (sgmllib module), 484
unlink function (os module), 175
unpack function (struct module), 196
Unpickler function (pickle/cPickle modules), 227
unpost method (Menu object), 345
unquote function
urllib module, 410
Utils module, 479
unquote_plus function (urllib module), 410
unzip program, 200
up command (pdb module), 387
update method
dictionary object, 50
Widget object, 333
update_idletasks method (Widget object), 333
upper method (string object), 149
uppercase attribute (string module), 150
URL access, 407-416
authentication, 415
urllib module, 410-412
FancyURLopener class (urllib module), 412
urllib2 module, 413-416
OpenDirector class, 415
Request class, 414
urlparse module, 408
url argument (distutils setup function), 563
URL file-like object
close method, 411
geturl method, 411
info method, 411
read method, 411
readline method, 411
readlines method, 411
urlcleanup function (urllib module), 410
urlencode function (urllib module), 410
urljoin function (urlparse module), 408
urllib module, 407, 410-412
FancyURLopener class, 412
quote function, 410
quote_plus function, 410
unquote function, 410
unquote_plus function, 410
urlcleanup function, 410
urlencode function, 410
urlopen function, 411
urlretrieve function, 412
urllib2 module, 407, 413-416
build_opener function, 413
install_opener function, 413
OpenDirector class, 415
OpenerDirector class, handler classes, 415
Request class, 414
urlopener function, 413
urlopen function
urllib module, 411
urllib2 module, 413
urlparse module, 407, 408
urljoin function, 408
urlsplit function, 408
urlunsplit function, 409
urlretrieve function (urllib module), 412
URLs (Uniform Resource Locators), 407
access to network protocols (see URL access)
analyzing/synthesizing, 408
outgoing, 485
reading data from, 410
urlsplit function (urlparse module), 408
urlunsplit function (urlparse module), 409
Usenet News (see network news)
user customization, 275
user input, errors depending on, 114
user method (POP3 object), 418
user module, 275
use_rawinput attribute (cmd module), 215
UserDict class (UserDict module), 143
UserDict module
data attribute, 143
UserDict class, 143
UserList class (UserList module), 143
UserList module
data attribute, 143
UserList class, 143
UserString class (UserString module), 143
UserString module
data attribute, 143
UserString class, 143
UserWarning class, 389
UTC (Coordinated Universal Time), 245
utc function (mx.DateTime module), 253
utctime function (mx.DateTime module), 253
Utils module (email package), 478
decode function, 478
dump_address_pair function, 478
encode function, 478
formatdate function, 478
getaddresses function, 478
mktime_tz function, 478
parseaddr function, 479
parsedate function, 479
parsedate_tz function, 479
quote function, 479
unquote function, 479
utime function (os module), 177
uu module, 471
decode function, 471
encode function, 471
UU (Unix-to-Unix) encoding, 471
V[ Top ]
value attribute
FieldStorage object, 458
Morsel object, 464
ValueError exception, 111, 146, 148, 172
values method (dictionary object), 50
variables, 39
assignment statements, 40-42
binding, 39
built-in, 115
class-private, 73
global, thread synchronization and, 281
module-private, 119
rebinding, 40
referencing, error, 110
sorted list of, 131
unbinding, 39
vars function (built-in), 137
VERBOSE attribute (re module), 161
version argument (distutils setup function), 563
version attribute (sys module), 141
version method
FancyURLopener object, 412
HTTPResponse object, 420
versions of Python, 7
Forum releases, 8
Python-in-a-tie releases, 8
v2.2
SimpleXMLRPCServer module, defect in, 442
time module, functions, 246
time module, strptime function, 248
type objects, 268
v2.3
datetime module, 245
logging, 380
sockets with timeout behavior, 437
vertical bar (|)
bitwise OR, 44
regular expressions, 157, 160
vim program, 24
Visual C++
building Python source, 12
for debugging, 14
interoperability of Python release and debugging builds, 14
runtime library, accessing extras supplied by, 211
Visual Python, 23
Visual Studio .NET IDE, 23
VxWorks, installing Python, 17
W[ Top ]
W3C (World Wide Web Consortium), 494
wait method
Condition class, 282
Event object, 283
wait_variable method (Widget object), 333
wait_visibility method (Widget object), 334
wait_window method (Widget object), 334
walk function (os.path module), 179
walk method (Message object), 475
warn function (warnings module), 391
warnings module, 388-391
filterwarnings function, 390
formatwarning function, 390
resetwarnings function, 390
showwarning function, 390
warn function, 391
WConio module, 212
weak references, 272
WeakKeyDictionary class (weakref module), 273
weakref module, 269, 272
getweakrefcount function, 272
getweakrefs function, 272
proxy function, 272
ref function, 272
WeakKeyDictionary class, 273
WeakValueDictionary class, 273
WeakValueDictionary class (weakref module), 273
weave package, 545
web servers, subclassing BaseHTTPServer, 468
Webware, 467, 490
Cheetah and, 490
Wednesday attribute (mx.DateTime module), 259
Weekday attribute (mx.DateTime module), 259
weekday function (calendar module), 252
wfile method (HTTPServer object), 441
where command (pdb module), 388
where function (Numeric module), 322
whichdb function (whichdb module), 232
whichdb module, 232
whichdb function, 232
while statements, 53
else clause, 58
whitespace
line indents in Python programs, 30
regular expressions, 161
separating tokens, 30
strings of, 147
whitespace attribute (string module), 150
widget attribute (Event object), 366
Widget class (Tkinter module), 330
after method, 369
after_cancel method, 369
after_idle method, 369
bind method, 368
bind_all method, 368
cget method, 333
config method, 333
focus_set method, 333
grab_release method, 333
grab_set method, 333
grid method, 363
grid_forget method, 364
grid_info method, 364
mainloop method, 333
pack method, 363
pack_forget method, 363
pack_info method, 363
place method, 365
place_forget method, 365
place_info method, 365
quit method, 333
unbind method, 368
unbind_all method, 368
update method, 333
update_idletasks method, 333
wait_variable method, 333
wait_visibility method, 334
wait_window method, 334
winfo_height method, 334
winfo_width method, 334
widgets, 328, 330-334
canvas, 356-360
lines, 358
polygons, 359
rectangles, 359
text, 360
checkboxes, 336
child/parent, 341
color options, 330
container, 341-344
frames, 341
top-level windows, 341
length options, 331
listboxes, 338
menus, 344-347
entry options, 345
pushbuttons, 336
radiobuttons, 339
scrollbars, 340
text, 347-356
coupling with scrollbars, 349
fonts, 354
indices, 352
marks on, 349
tags on, 350
text entry fields, 337
Tkinter module, 336-360
win32all extensions, 466
win32all package, 545
Window class (curses module)
addstr method, 209
clrtobot method, 209
clrtoeot method, 209
delch method, 209
deleteln method, 209
erase method, 209
getch method, 209
getyz method, 210
insstr method, 210
move method, 210
nodelay method, 210
refresh method, 209
window_create method (Text object), 348
Windows
applications, embedding/extending Python with COM, 545
CGI scripting on, 459
file ownership, 174
installing Python from binaries, 17
binary package for 32-bit version of, 17
installing Python from source, 13-15
building for debugging, 14
building source with Visual C++, 13
uncompressing/unpacking source code, 13
internationalization, 155
keys into os.environ, 288
mbcs codec, 155
mmap function, 292
py2exe tool, 568
Python IDEs, 23
Python scripts, 25
resource for further information, 237
text editors with Python support, 24
WindowsError exception, 111
winfo_height method (Widget object), 334
winfo_width method (Widget object), 334
Wing IDE, 23
winutils.zip utilities, 13
WinZip program, 200
uncompressing/unpacking tar archive files, 13
withdraw method (Toplevel object), 343
World Wide Web Consortium (W3C), 494
wrapper function (wrapper module), 208
wrapper module, wrapper function, 208
write function
os module, 186
ZipFile class, 202
write method
file object, 191
mmap object, 294
transports object, 452
write_byte method (mmap object), 295
write_history_file function (readline module), 207
writelines method (file object), 191
write-only file mode, 187
writeread_all method (Telnet object), 428
writestr function (ZipFile class), 202
writexml method (Node object), 510
wxWindows toolkit, 23
X[ Top ]
XHTML, 481
changing/outputting with minidom, 511
parsing, 488
with minidom module, 507
with pulldom module, 508
with xml.sax, 500
Xitami servers
installing Python CGI scripts on, 462
LRWP for, 466
XLink, 494
XML (eXtensible Markup Language), 494-511
generating, 508-510
parsing, 495-508
with DOM, 501-508
with SAX, 496-500
Python support for, 494
xml package, 494
xml.dom package, 502
DOMException class, 502
XMLGenerator class (saxutils module), 500
XMLReader object
close method, 499
feed method, 499
reset method, 499
XML-RPC, 407, 428-430
xmlrpclib module, 429
XML-RPC servers, 429, 442
xmlrpclib module, 429
Binary class, 429
binary function, 429
Boolean class, 429
boolean function, 429
DateTime class, 430
ServerProxy class, 430
xmlrpclib protocol, 407
xml.sax package, 496-501
attributes, 498
ContentHandler class, 497
incremental parsing, 499
make_parser function, 496
parser function, 496
parseString function, 497
SAXException class, 496
saxutils module, 499
xor_ method (operator module), 300
_ _xor_ _ special method, 98
XPath, 494
XPointer, 494
xrange function (built-in), 55, 137
xreadlines function (xreadlines module), 197
xreadlines method (file object), 191
xreadlines module, 197
xreadlines function, 197
x_root attribute (Event object), 366
XSLT, 494
xview method (Text object), 348
Y[ Top ]
year attribute (DateTime class), 256
yield keyword, 67
y_root attribute (Event object), 366
yview method (Text object), 348
Z[ Top ]
ZeroDivisionError exception, 111
zeros function
jarray module, 553
Numeric module, 311
ZIP files, 200
zip function (built-in), 137
zip program, 200
ZipFile class (zipfile module), 200
close method, 201
getinfo function, 201
infolist function, 201
namelist function, 201
printdir function, 201
read function, 201
testzip function, 202
write function, 202
writestr function, 202
zipfile module, 200-203
is_zipfile function, 200
ZipFile class, 200
ZipInfo class, 200
ZipInfo class (zipfile module), 200
attributes, 200
zlib module, 203
compress function, 203
decompress function, 203
Zope, 466
Return to Python in a Nutshell
|