Programming Python
Programming Python Object-Oriented Scripting

By Mark Lutz

Cover | Table of Contents | Index | Colophon


Index


[ Symbols ],
[ A ], 
[ B ], 
[ C ], 
[ D ], 
[ E ], 
[ F ], 
[ G ], 
[ H ], 
[ I ], 
[ J ], 
[ K ], 
[ L ], 
[ M ], 
[ N ], 
[ O ], 
[ P ], 
[ Q ], 
[ R ], 
[ S ], 
[ T ], 
[ U ], 
[ V ], 
[ W ], 
[ Y ] 

Symbols[ Top ]
& operator (shell), 117
* (asterisk)
   with from statement, 126, 149
   prefixing argument name, 162, 202
   repetition operator, 125
@ (at sign), 790
` (backquote), 160
\ (backslash), 100
! statement (pdb), 370
!= (inequality) operator, 91
{} (braces), 28, 100, 183
[] (brackets), 100, 124
   for slices (see slices)
: (colon), 817
, (comma), 161
$ (dollar sign), 790
" (double quotes), 103
= (assignment) operator, 88
== (equality) operator, 92
# (hash mark), 84, 98, 816
< (redirect) shell operator, 113
< (less than) operator, 92
<> (inequality) operator, 92
> (redirect) shell operator, 113
> (greater than) operator, 92
() (parentheses), 100, 142, 161, 258
% for string formatting, 160, 775
| (piping) operator, 113
+ (concatenation) operator, 108, 265-271, 275, 827
? (question mark), 790
' (single quotes), 104
; (semicolon), 100-101
_ (underscore), variables starting with, 126
\0 for null character, 119

A[ Top ]
abstract object access API, 635, 752
abstraction, 347
access class attributes, 243
active code, reloading, 177
__add__ method, 265-267
administration, 81
   scripts for (see shell tools)
.after, .after_idle tools, 383
AI (artificial intelligence), 732
ampersand (&) shell operator, 117
anchors, 356
and keyword, 135
anonymous function objects, 214, 835
API, Python
   abstract object access, 635, 752
   embedded-call, 572-577
   errors, detecting, 577
   OLE, 723
   run-time, 515
   WPY and wxPython, 738-742
APP tags, 719
append(), 109, 267, 824
applets, 718-721
applications for Python, 7
apply(), 163, 205, 744, 753
arguments, 142-144, 154
   default, 143, 163
   lists of, 521
   matching modes, 204
   order of, 203
   passing by assignment, 142
   variable-length lists of, 162-164
arrays (see sequence objects)
   associative (see dictionaries)
assignment, 88, 145-146, 760, 772, 816
   instance attributes, 233-234
   nested shelves, 401
   passing arguments by, 142
   tuples, 191-192
associative arrays (see dictionaries)
asterisk (*), prefixing argument name with, 162, 202
at sign (@), 790
attributes, 783, 854
   object, 90, 199
   special, 783
automatic
   GUI construction, 330-347
   language integration, 64, 630-636

B[ Top ]
background activities, 383
backquote (`), 160
backslash (\), 100
BASIC language, 701
batch mode, 165-167
bgen system, 634, 757
bidirectional IPC, 729-730
binaries (see source code)
binary
   search trees, 480-484
   operators, 458
bind(), 355
bison system, 656
blank lines, 101
block delimiters, 726
blocks, code (see code)
boolean operators, 190
bound methods, 257-258
braces {}, 28, 100, 183
brackets [], 100, 124
   for slices (see slices)
branching, multiway, 159, 184
break statement, 129, 193-194
breakpoints, 366
browser(), 332
browser, Python-based, 718-721
browser, table, 393-424
bsddb module, 749
building Python from source code, 68
__builtin__ module, 776
__builtins__ module, 583
Button object, 26
buttons, 312, 355, 394, 679
byte-by-byte reading (see reading from files, read())

C[ Top ]
C language, 54-62, 474, 505
   C extension modules, 170, 508-515
   C extension types, 508, 532-568, 635
   data conversion codes, 523-524
   data types, 171
   debugging, 364, 371
   embedding Python in, 571-639
   exceptions, 525
   keyword argument values, 561
   searching files for constants, 644
   translating to Python, 757
   (see also extensions)
-c option, python, 74
C++ language, 35, 624, 757, 854-857
calculator GUI, 675-684
__call__ method, 747
call routing, 516, 543-544
call statement, 121
callable object types, 258
callback handlers, 313, 319, 364-371, 377-380
   scheduled callbacks, 383
capitalization (see case sensitivity)
cascades, 325
case sensitivity, 90
case statement (see elif clause)
catching exceptions (see exceptions)
CD-ROM with book, xx
CGI script, 735-737
character-by-character reading (see reading from files, read())
characters (see string objects)
circular module dependency, 171-173
__class__ attribute, 333
class methods, 227, 319
class statement, 227-230, 240, 244, 762
classes, 15, 220, 226-232, 250-253, 284, 383, 842-851
   accessing attributes from methods, 243
   buttons as, 679
   class instances (see instances)
   constructors, 235-238
   debugging with, 372-375
   globals for, 243
   graphs to, 487-489
   inheriting from multiple, 259-261
   menus as, 221-226
   mixin, 330-334
   namespaces, 238-248
   persistent instances, 426-436
   running in module files, 596
   set, 465-468
   sharing between languages, 624-630
   stack, 441-462
   subclasses, 27, 223, 287, 315-319, 338, 449, 683
   widget, 381
   wrapper, 421-424, 563-566, 625-630
clone(), 332
close(), 122
closures, 746-748
__cmp__ method, 443
code, xx, 133-135, 704
   #! line, 113
   active, reloading while, 177
   compounding lines of, 99
   GUI (see GUI)
   incremental development, 173-179
   indentation of, 98
   interactive coding, 114-117
   optimizing, 676-679
   reusing, 138, 684, 709
   trusted execution, 752
__coerce__ method, 458
coherence, 5
cohesion, 173
colon (:), 817
columns
   summing, 641
   text in, 49
combinations of sequences, 494-496
combo(), 494
comma (,), 161
command option, 312, 355
command-line arguments, 95
command-line interpreter, 72-74, 113
   -c option, 74
commands
   menu lists for, 186-195
   pdb debugging, 366
   shell, running in Python, 115
comments, 84, 98, 101, 726
communication, interprocess, 116
compacting code, 133-135
comparing, 91
   functions for, 498
   stacks, 550
compiled code, 294
completion (see globbing, filename)
complex numbers, 755
composition, 289, 848
compounding code lines, 99
concatenating, 108-110, 265-271, 827
   menus, 271, 274
   string objects, 47-50, 108
const modifier (C++), 855
constants, 644, 762
   mathematical, 790
constructors, 235-238, 413, 542, 847, 856
continuation lines, 100
continue statement, 193-195
converting
   between languages (see translating)
   data types, 576
   lists and tuples, 824
   sequence objects, 500-504
   to/from strings, 160
   wrapped objects, 627-630
copying
   copy module, 751
   lists and dictionaries, 267
   variables from modules (see from statement; import statement)
counter loops (see loops)
coupling modules (see dependency, module)
CPU time, 555
.createfilehandler tool, 384
csh (C shell), 23
customization, 30, 448-450

D[ Top ]
%d format code, 161
data conversion codes, 523-524
data entry dialogs, 353
data members (see members)
data sources, external, 16-18
data structures, 28-39
data types, 102-111, 196-198, 480-504, 763-769, 820-832
   in C modules, 171
   converting, 576
   declaring, 39
   dictionaries, 183-184
   integers, 559
   kjbuckets extension, 750
   sets, 462-479
   special attribute names, 783
   special class methods, 455-458
   stacks (see stacks)
   switching, 218-219
   testing for, 212
   tuples, 161-164
database systems, 388
dbm extension module, 69-70
dbm files, 39-41, 390, 410-417
dbx debugger, 364
dealloc operation handler, 546
debugging, 595
   Python debugger, 363-375, 750
declaring
   data types, 39
   variables, 85
DECREF (see Py_DECREF())
def statement, 141, 146, 214, 762
default
   argument values, 143, 163
   lambdas, 319
   menu values, 271
   shared mutable objects, 276-279
deferred calls, 319
__del__ method, 400, 458, 847
del statement, 399
__delattr__ method, 400
__delitem__ method, 400
__delslice__ method, 400
dependency, module, 168, 171-173
destructors (see constructors; __del__ method)
development
   cycle, Python, 697-713
   incremental, 173-179
dialogs, 320-321, 353
__dict__ attribute, 198, 246-248, 841
dictionaries, 25, 181-186, 197-198, 557, 766, 768, 822
   binary search trees versus, 483
   copying, 267
   instances as, 238
   keyword arguments, 202-207
   namespace, 246-248
   objects as keys, 312
   sets, 34-35, 469-472
   shelves, 390
   Tkinter and, 311
   (see also namespaces)
dir(), 199, 292
dmb module, 749
__doc__ attribute, 752
documentation, 71-72
   comments (see comments)
   strings, 752
   (see also help)
dollar sign ($), 790
double quotes ("), 103
downloading Python, 68
dumbdmb module, 7549
dummy modules, 591
dynamic
   binding, 518, 545
   interfaces (see GUI)
   menus, 264-279
   namespaces, 244
   typing, 39, 47

E[ Top ]
elif clause, 94, 159
   (see also if statement)
else clause, 190-192
   (see also if statement; try statement)
emacs text editor, 789
embedding Python, 62, 571-639, 676
   in C, 61-64
encapsulation, 15, 35, 282
ending statements, 100-101
environment variables, 66
EOFError exception, 132, 158
equality and equality operators, 91-92, 827
errors, 132, 151
   ErrorObject object, 525
   programming, 361-375
   stderr stream, 96, 117
   (see also exceptions)
escape codes, 119, 774
eval function, 49, 496-498, 674
eval statement, 200
event-driven programming, 314
events, window manager, 399
except clause, 131, 262, 852
exceptions, 22, 361, 489, 525, 530-532, 552, 574, 776, 851-853
   else clause, 190-192
   EOFError, 132, 158
   exception lists, 262
   handling with try statement, 131-132, 148
   parser, 673
   raise statement, 132, 151-152
   (see also errors)
exec function, 496-498, 674
exec statement, 200
execv(), 334
exiting
   code, 139
   exit statement, 139
   loops, 129
expand option, 339
expanding menus, 264-279
expect tool, 749
expressions, 760
extensions, 9, 54-64, 505-570, 749-750
   extension languages, 6
   filename (see suffixes, filename)
   granularity, 216-219
   installing, 69-71
   Python, future, 754-758
external
   data sources, 16-18
   files, 121-122, 125-126
   overriding modules, 208

F[ Top ]
%f format code, 161
FAQ, Python, 71
fastset (see sets)
file descriptors, 388
file methods, 118-121
file objects, 121, 125, 506, 765-767
   closing, 122
   dbm, 39-41
   filesystem structure, 97
   flat files, 387
   grep utility, 652-654
   opening for read/write (see open())
   processing differences, 656
   reading from (see reading from files)
   redirection (see redirection)
   scanning for, 16-18
File Transfer Protocol (FTP), 68, 72, 712
filenames
   globbing, 113, 115
   .py extension, 114
   suffixes, 520
files (see file objects)
fill option (windows), 339
filter(), 744
filters (see regular expressions)
finally clause, 132, 852
flat files, 387
floating-point numbers (see number objects)
flush(), 388
for loop, 93, 123, 128, 761, 819
fork(), 334
format
   formatting codes, string, 775
   string, 160
   text in columns, 49
FormGui class, 394-401
formtbl extensions, 417-420
forward references, 141
Frame class, 26
frame widgets, 314
frames, inheritance and, 317-319
freeware, 4
freeze tool, 294, 725
from statement, 24, 119-121, 126, 149, 169, 177, 179, 761
FTP (File Transfer Protocol), 68, 72, 712
functions, 91, 139, 141-144, 152-155, 776-778, 784, 832-837
   anonymous, 214, 835
   apply(), 163
   C, routing calls to, 516, 543-544
   comparison, 498
   in dictionaries, 185
   generating, 496-498
   generic, 248
   import statements in, 148
   keyword arguments, 202-207
   linking to callback handlers, 313
   mathematical, 790
   menu, 211-215
   namespaces, 199
   None return value, 195
   overloading, 855
   POSIX, 787-789
   running in module files, 596
   scripts versus, 159-164
   set, 462-465
   variables in, 144-147

G[ Top ]
%g format code, 161
garbage collection, 122, 546, 766
   reference count management, 400, 526, 544, 585-586
gdb debugger, 364
gdbm (see dbm files)
generating
   exceptions (see raise statement)
   programs, 496-498
generic functions, 248
getargs(), 522
getattr(), 200, 543
__getattr__ method, 264, 417
getenv function (in C), 54
Get_Global(), 593
__getitem__ method, 268, 411, 452, 458
getting binaries from Web, 71
getting source code, xx
global
   instance inaccess to, 243
   namespace, 144, 154, 241
   variables, 155, 837
global statement, 154
globbing, filename, 113, 115
Grail browser, 703, 718-721, 734
grammar, Python, 768-772
granularity, 216-219
graph searching, 484-491
graphical user interface (see GUI)
graphs of objects, 35
greater than (>) operator, 92
grep utility, 652-654
gridded mode, 351
grouping (see tuples)
GUI (graphical user interface), 24-28, 307-385, 507, 757
   automating, 330-347
   calculator, 675-684
   frame widgets, 314
   inheritance, 315-319
   menus and toolbars, 323-329
   PythonWin, 724
   table browser, 393-424
   updating windows, 379
   window layout, 339, 351, 380, 681-683
   window manager events, 399
   WPY and wxPython systems, 738-742
Guido van Rossum, 3, 72
GuiMaker class, 334-339, 343-347
GuiMixin class, 330-334

H[ Top ]
handling exceptions (see exceptions)
hash mark (#), 816
   for comments, 84, 98
__hash__ methods, 312
hash tables (see dictionaries)
has_key method, 184
header file, Python, 514
headers, searching for patterns in, 650-652
help, 71-72
hexadecimal constants, 103
history of Python, 3-4
holmes system, 643, 732
home page, Python, 72
HTML, Grail for, 718-722, 735

I[ Top ]
Icon language, 701
if statement, 94, 129, 159, 762, 816
ILU package, 634, 727, 730-732
image processing, 755
immutability, string, 106
implied-delimiter syntax, 101
import statement, 84, 93, 120, 126, 148, 168, 176, 520, 761
   circular module dependency, 171-173
   transitive, 177, 179-180
   (see also reload())
importing modules, 752
in operator, 111, 820
incremental development, 173-179
indentation of code, 98, 726, 817
index method, 190
IndexError exception, 151
indexes, sequence (see sequence objects)
indexing, 184, 267, 820, 830
   lists, 189
inequality (!=) operator, 91
inequality (<>) operator, 92
inheritance, 16, 26, 207, 229-232, 237, 280, 337, 845, 855
   frames and, 317-319
   from multiple classes, 259-261
   precedence, 232, 260
   widgets and, 315
__init__ method, 235-237, 443, 847
initialization function, 515
input/output, 127, 132
   raw_input(), 130-133
   redirection, 21-23, 113, 165-167
   stdin/stdout stream, 95-96
   (see also reading from files)
installing
   extensions, 69-71
   Python, 67-71
instances, 16, 230, 266, 410-417, 541, 543-544, 624-627, 844
   assigning attributes, 233-234
   configuring with constructors, 235-238
   as dictionaries, 238
   global inaccess, 243
   namespaces, 238-248
   persistent, changing classes of, 426-436
   self, 228-229, 270
integers, 559, 815
integration, 5, 53-64, 392, 505-639, 700
   automatic, 64, 630-636
   OLE, 723
interactive coding, 114-117, 833
interclass method calls, 253
interface, 152, 156-159
   API (see API)
   batch mode, 165-167
   calculator GUI, 679
   as class system, 250-253
   dictionary menus, 181-186
   GUI, 307-385
   keyed-access database, 749
   menu lists, 186-195
   OLE, 723
   shell tools, 356
   WWW/Internet, 732-737
Internet, Python tools for, 732-737
interpreter (see command-line interpreter)
interprocess communication, 116
intersection() (see sets)
intersections, set, 31
IPC tools, 729-730
is operator, 92, 550
item(), 503
items(), 824

J[ Top ]
Java, 703
join(), 167
joining strings, 47-50

K[ Top ]
key-value pairs, 183, 204
keyed-access database interface, 749
keys method, 184, 199
keyword arguments, 25, 202-207, 561
kjbuckets extension, 750
kwParsing system, 656

L[ Top ]
lambda statement, 134, 214, 319, 498, 744
languages (see programming languages)
layout, window, 339, 351, 380, 681-683
LEFT constant, 315
len(), 123, 831
__len__ method, 458
less than (<) operator, 92
LIFO lists (see stacks)
line-by-line input (see reading from files, readline())
linking namespaces, 245
Linux operating system, xix
list constants, 105
listboxes, 351
listdir(), 116
lists, 162, 820
   argument, variable-length, 162-164
   stacks as, 438
   tuples (see tuples)
load, system (see performance)
Load_Attribute(), 590
loading modules (see from statement; import statement)
Load_Module(), 590
local
   data in C extensions, 515, 540
   methods, 256-258
   namespaces, 144, 199, 241
   variables, 834
logging, 216, 285-290
logical operators, 190
long integers, 103
loops, 85, 93, 110, 123-125, 192, 818
   breaking, 129
   for, 93, 123, 128, 761
   while, 127-128, 761

M[ Top ]
Macintosh systems, 742
__main__ module, 73, 170, 366
mainloop(), 309, 359
makefile, embedding Python, 578, 604
manual searching of lists, 189
map function, 17
map(), 134-135, 502, 744
mapping, 106, 557-561, 786
   method calls to classes, 227
   mutable (see dictionaries)
   Tk/Tkinter, 382
matching patterns (see regular expressions)
math module, 790
matrix object, 755
members, 229, 234
__members__ method, 544, 549
membership (see in operator)
memory (see garbage collection)
menugui2 module, 352
menus, 181-209, 323-329
   cascading, 325
   as classes, 221-226
   concatenating, 274
   configuring data for, 233-238
   dynamic, 264-279
   functions for, 211-215
   GuiMaker class, 334-339, 343-347
   indexing, 267
   pull-down, 324
   tear-off, 325
   type-switching, 218-219
messages (see interclass method calls)
messages, error, 151
metaclass protocol system, 59, 271
metaprogramming, 200-201
METH_KEYWORDS (value), 561
method functions, 515
methods, 16, 91, 196, 227, 766
   accessing class attributes from, 243
   interclass calls, 253
   local, 256-258
   mapped to type descriptors, 566-568
   metaclass, 59, 271
   registering, 256-258, 620-622
   self instance and, 228
   special class methods, 455-458
   virtual, 854
__methods__ attribute, 200, 549
mixin classes, 330-334
modal windows, 355
modulator tool, 64, 630-633
modules, 13, 84, 168-180, 196, 207-209, 284, 778-782, 837-842
   C extension, 54-60, 508-515
   circular dependency, 171-173
   classes and, 225
   externally overriding, 208
   importing, 751
   loading (see import statement)
   overwriting names of, 119
   packaging with freeze, 725
   reloading, 173-180, 374-375, 591, 605, 842
   for reusing information, 138
   search path order, 519
   stacks as, 439-441
   statement order, 140
   using in C, 590-593
   wrapper, 57-60
   WWW/Internet, 718-721, 732-737
modules dictionary, 198
more than (see greater than)
mSQL system, 388
multiple inheritance, 232, 259-261, 337
multiple-line statements, 100
multiway branching, 159, 184
mutability, 106, 109, 154, 542, 831
   mappings (see dictionaries)
   objects, 276-279
   sequences, 787

N[ Top ]
n command (pdb), 368
\n for newlines, 119
__name__ module, 140-141, 840
named references (see variables)
names
   from statements and, 119
   Python library symbols, 527
   Python, source of, 65
   qualified, 90
   variables, starting with _, 126
namespaces, 90, 144-147, 179, 198-201, 238-245, 358, 772, 844
   dummy modules, 591
   dynamic, 244
   lambda statement and, 214
   linking, 245
   module, changing externally, 208
   nested, 244
   pdb and, 374
   scope versus, 240
   searching, 241
ndbm (see dbm files)
nested
   break statements, 193-194
   class statements, 244
   code blocks, 99
   continue statements, 194
   data structures, 188
   def statements, 146
   deleting nested items, 399
   exceptions, 852
   frame widgets, 315
   import statements, 148
   method calls, 253
   namespaces, 145-147, 244
   shelves, 401
   try statements, 132
Netscape plug-in, Python as, 743
newlines, 119
newsgroup, Python, 72
None (value), 121, 195, 824
notdone method, 326
null characters, 119
number objects, 103, 197, 557-561, 764, 786, 815
   complex, 755
   converting to strings, 161

O[ Top ]
object trees, 188-191
object-oriented programming, 5, 53, 207-209, 219-221, 253, 290, 705
   object-oriented databases (OODBs), 758
   wrapper classes, 563
objects, 13, 209, 220
   abstract object access API, 752
   anonymous, 214, 835
   attributes of, 90, 199
   in C, 515
   callable object types, 258
   classes (see classes)
   deep copies of, 751
   default shared mutable, 276-279
   as dictionary keys, 312
   file (see file objects)
   graphs of, 35
   indexing, 124
   list (see lists)
   numeric (see number objects)
   packaging, 279
   passing, 142
   persistent, 41-47
   stacks, 438-462
   string (see string objects)
   tuples of, 161-164
   wrapped, looking like Python, 627-630
octal constants, 103
OLE integration, 723
OLE scripting, Python for, 755
OOP (see object-oriented programming)
open(), 85, 96, 133, 387
open architecture, 9
operations, 762
operators, 196, 785-787, 832
   binary, 458
   logical (boolean), 190
   overloading, 264-279
   precedence, 773
   regular expression, 648
   stack versus module, 443
optimization, 450-455, 753-755
code, 676-679
   sets, 34-35, 469-474
   (see also performance)
or keyword, 135
order (see precedence)
os module, 116-117, 388
output (see input/output)
overloading
   functions, 855
   indexing, 267
   operators, 264-279, 459
overriding modules externally, 208
overwriting module namespace, 119, 176

P[ Top ]
p statement (pdb), 370
packaging, 279, 294, 725, 751
pack(), 310
parentheses (), 100, 142, 161, 258
parsing (see processing)
pass statement, 158
passing objects, 142
PATH environment variable, 66
pattern-matching, 50
patterns (see regular expressions)
PC port for Python, 722-725
pdb debugger, 363-375, 595
percent sign (%) for string formatting, 160, 775
performance, 9, 622
   C extensions, 552-557
   compacting code, 133-135
   indexing, 191
   reading from files, 17
   scripts versus functions, 159
   sets, 466, 470-472
   stacks, 448-450, 454-455
   text filtering, 655
Perl language, 700
permutations of sequences, 494-496
permute(), 494
persistent-object stores (see shelves)
persistence, 41-47, 387-436, 507, 757
pickle module, 41-47, 392
pindent utility, 101, 726
pipe(), 729
piping input/output, 113
platforms, xix, 75, 519
   Macintosh, 742
   Windows, 722-725
polymorphism, 281
popen(), 116
pop() (see stacks)
pop-up dialogs, 320, 353
portability, 586, 722, 729
porting Python, 75
POSIX
   posix module, 388, 787-789
   regular expressions, 750
PostGres95 extension, 749
power, semantic, 5
precedence
   inheritance, 232, 260
   operator, 774
precompiled source code, 294
pregrex extension, 750
print statement, 85, 95, 130, 362, 445
printing, 762
private members, 855
procedures (see functions)
processing
   file objects, 656
   hand-coded parsers, 657-674
   languages, 52
   parser generators, 656
   rule strings, 642-644
   text, 47-53, 640-675
profile module, 467
programming, 697-700, 744-748
   errors, 361-375
   event-driven, 314
   generic functions, 248
   GUI (see GUI)
   incremental development, 173-179
   interactive, 834
   metaprogramming, 200-201
   object-oriented, 5, 53, 207-209, 219-221, 253, 290, 563
   simplicity, 195, 207
   structure, 13
programming languages, 6, 700
   C++, 35
   debugging and, 371
   integrating, 53-64
   processing, 52
   RAD, 375-380
   sharing classes, 624-630
programs (see scripts)
Prolog language, 192
protocol, 16
PSA (Python Software Activity), 4
pull-down menus, 324
   (see also menus)
pure virtual methods, 253, 856
push() (see stacks)
putenv function (in C), 54
.py filename extension, 114
PyArg_Parse(), 522, 576, 616
PyArg_ParseTuple(), 521, 576
PyArgs_VaParse(), 576
Py_BuildValue(), 522, 576
.pyc files, 294
Py_CompileString(), 576
Py_DECREF(), 527, 574, 585
PyDict_GetItemString(), 575
PyDict_New(), 575, 583
PyDict_SetItemString(), 527, 575
PyErr_Fetch(), 574
PyErr_IndexError(), 574
PyErr_Occurred(), 526, 574
PyErr_Print(), 574
PyErr_SetString(), 525, 530, 574
PyEval_CallObject(), 575, 581, 620
PyEval_EvalCode(), 576
PyEval_InteractiveLoop(), 576
PyEval_SimpleFile(), 575
PyEval_SimpleString(), 576
PyEval_String(), 576
Py_FatalError(), 527
Py_FindMethod(), 544
PyGres extension, 750
PyImport_AddModule(), 575, 581
PyImport_GetModuleDict(), 575
PyImport_ImportModule(), 575, 580-581
PyImport_ReloadModule(), 575
Py_INCREF(), 526, 574
PyInt_FromLong(), 576
PyMem_DEL(), 544
PyMethodDef(), 527, 576
PyModule_Check(), 574
PyModule_GetDict(), 527, 575, 580
PyObject object, 574
PyObject_DEL(), 577
PyObject_GetAttrString(), 574
PyObject_HEAD(), 577
PyObject_NEW(), 543, 577
PyObject_Print(), 574
PyObject_SetAttrString(), 574, 581
PyRun_File(), 573
PyRun_SimpleFile(), 573
PyRun_SimpleString(), 577
PyRun_String(), 573, 579
PySequenceMethods, 576
PyString_AsString(), 576
PyString_Check(), 574
PyString_FromString(), 576
Python
   abstract object access API, 635, 752
   debugger, 363-375, 595
   development cycle, 697-713
   embedded-call API, 572-577
   extensions (see extensions)
   FAQ on, 71
   functional structure, 290-294
   future of, 754-758
   history of, 3-4
   installing, 67-71
   interpreter (see command-line interpreter)
   as OLE scripting tool, 755
   profiler, 467
   release 1.2, 385
   release 1.4, 756
   run-time API, 515
   translating to/from, 757
   tutorial, 813-853
   where name came from, 65
Python Software Activity (PSA), 4
Python.h header file, 514
PYTHONPATH environment variable, 67, 520, 838
PYTHONSTARTUP environment variable, 67, 201
PythonWin, 722-725
_PyTuple_Resize(), 575
PyTuple_SetItem(), 575
PyTuple_Size(), 575
PyTypeObject, 577
Py_VaBuildValue(), 576
Py_XDECREF(), 527, 575
Py_XINCREF(), 527, 574

Q[ Top ]
qualification, 85, 773, 841, 845
qualified names, 90
question mark (?), 790

R[ Top ]
r command (pdb), 370
RAD (Rapid Application Development), 375-380
__radd__ attribute, 275
raise statement, 22, 132, 151-152, 753, 762, 851-853
range(), 123-124, 493, 821
Rapid Application Development (RAD), 375-380
raw_input(), 130-133
reading from files
   readlines(), 17, 86
   readline(), 127-130
   read(), 85, 97, 130
recursive
   function calls, 836
   mainloop calls, 359
   sequence object reversal, 491
redirection, 21-23, 113, 165-167
reduce(), 744
redundancy, 216, 219
ref parameters (C++), 855
reference count management, 400, 526, 544, 585-586
reference manuals (see documentation)
references, 88, 144, 774, 826
   arrays of (see lists)
   to instance attributes, 233
   named (see variables)
   simplified management of, 755
regex module, 50, 646
registering methods, 256-258, 515, 561, 620-622
registration table, 56
regression test script, 19
regsub module, 647
regular expressions, 50, 645-656, 750
relational algebra and sets, 474-479
reload(), 173-180, 374-375, 842
reloading modules, 591, 605, 842
Remote Procedure Calls (RPC), 424
rename header file, 527
repetition, 125, 828
__repr__ methods, 443, 458, 565
reserved words, 89, 773
resizing windows, 339, 351
return statement, 142, 153, 762
   (see also functions)
reusing code, 138, 684, 709
reversing sequences, 491-494
RIGHT constant, 315
right-side variants, 458
Rivet library, 750
routing calls to C functions, 516, 543-544
RPC (Remote Procedure Calls), 424
rule strings, 642-644
Run_Function(), 596, 616

S[ Top ]
%s format code, 160
scanning for files, 16-18
scheduled callbacks, 383
Scheme language, 700
scope (see namespaces)
scope operator, 856
scripting languages, 6
scripts, 159-164
ScrolledText class, 333
searching
   binary search trees, 480-484
   C files for constants, 644
   C header files, 650-652
   graphs, 484-491
   grep utility, 652-654
   inheritance, 232
   instance attributes, 233
   lists (see indexing)
   namespaces (scopes), 241
   search path, 66, 519
   strings, 646
self instance, 228-229, 270, 843
semantic power, 5
semicolon (;), 100-101
sequence objects, 106-110, 123-125, 541, 767, 787, 820
   converting, 500-504
   copying, 267
   dictionaries (see dictionaries)
   exception lists, 262
   indexing, 124, 189, 267
   lists, 104, 186-195, 197, 765
   map() with, 135
   permutations of, 494-496
   repetition, 125
   reversing, 491-494
   sorting, 498-500
   stacks and, 446
   tuples, 161-164
setattr(), 415-417
__setattr__ method, 415-417, 458
Set_Global(), 593
__setitem__ method, 268, 411
sets, 31-35, 462-479
   moving to dictionaries, 469-472
shared mutable objects, 276-279
shell tools, 12-23, 81-117, 159-164, 356, 507
ShellGui module, 349-351
shells
   command-line interpreter as, 74
   commands, running in Python, 115
   globbing and redirection, 113
shelve module, 41-47
shelves, 390
shortening code, 133-135
signals, 727
silent mode, 165
simplicity of programming, 195, 207
single quotes ('), 104
size, data types, 831
slices, 22, 86, 106-109, 128, 829
   slice assignment, 108
SmallTalk language, 701
sockets, 727-729
sort(), 398, 500
sorting sequences, 498-500
source code
   #! line, 113
   building Python from, 68
   compiled/precompiled, 294
   getting from Web, xx, 71
   (see also code)
spawn(), 332, 334
special
   attribute names, 784
   characters, 119, 774
speed (see performance)
split(), 641
splitfields(), 641
splitting strings, 47-50
stack_as_sequence struct, 542
stacks, 28-31, 438-462
   comparing, 550
   stack dump, 361
Stacktype struct, 542
statements, 13, 92-95, 759-761, 816-819
   implicitly ending, 100-101
   loops (see loops)
   multiple-line, 100
static
   binding, 517, 545
   language build cycle, 699
   members, 234, 855
   stacks class data, 450
stderr stream, 96, 117
stdin stream, 95, 132
stdio filesystem, 97
stdout stream, 95
stopping (see exiting)
__str__ method, 458
streams, redirecting, 21-23
string module, 641-645, 784
string objects, 47-50, 103, 197, 764, 825
   C extension modules, 509
   code (see embedding Python; extensions)
   comparing, 91
   concatenating, 108
   documentation, 752
   escape codes, 119, 774
   formatting codes for, 775
   formatting with %, 160
   immutability of, 106, 109
   regular expressions, 645-656
   repetition, 125
   rule, 642-644
structure, programming, 13
stub wrapper classes, 563-566, 625-630
subclasses (see classes)
subset(), 494
substitution, string, 647, 656
substrings (see strings)
suffixes, filename, 520
summing columns, 641
SWIG system, 635
switch statement (see elif clause)
symbols, 744, 769
syntax, Python, 98
SyntaxError exception, 770
sys module, 84, 117, 841
system administration, 81
   scripts for (see shell tools)
system(), 117
system load (see performance)

T[ Top ]
\t for tabs, 119
table browser GUI, 393-424
Tcl language, 69, 382, 700
tear-off menus, 325
testing
   data types, 212
   extensions, 529-532, 547-552
   FormGui interface, 402-410
   formtbl extensions, 417-420
   GuiMaker class, 337
   menu functions, 213
   mixin methods, 333
   sequence permutations, 495
   set classes, 465
   set functions, 463-464
   unit testing, 173
   validation, 613, 618
text
   processing, 47-53, 640-675
   ScrolledText class, 333
this instance pointer (C++), 854
timer module, S, 454-455, 552
Tix library, 750
Tk language, 69, 382, 750
Tkinter module, 70, 307, 380-384
   GUI system, 742, 754
   Python debugger, 750
   Tix library, 750
   tkinter extension module, 69
tokens, 769
toolbars, 323-329
   GuiMaker class, 334-339
TOP constant, 311
traceback object, 753
transitive imports, 177, 179-180
translating
   conversion codes, 523-524
   Python to/from C, 520-524, 576, 757
   Tcl/Tk to Python/Tkinter, 382
trees, class, 27
troubleshooting, 71-72
   circular imports, 173
   reloading modules, 178
trusted code execution, 753
try statement, 22, 128, 361, 761, 851-853
   exception handling, 131-132, 148, 191
tuples, 161-164, 191-192, 197, 766, 823
   stacks and, 450-455
   tuple packing, 22
   (see also lists)
type(), 212
type descriptors, 541-542, 566-568
type methods, 258
types (see data types)
types module, 212

U[ Top ]
unbound methods, 257
underline option, 327
union() (see sets)
unions, set, 31
unit testing, 173
unparsing (see processing)
unqualified names, 199, 241-244
updating windows, 379
user interface (see GUI; interface)

V[ Top ]
validation, 216, 285-290, 609-620
van Rossum, Guido, 3, 72
variable-length argument lists, 162-164
variables, 88, 155, 198, 815
   declaring, 85
   environment, 66
   in functions, 144-147
   inheritance and, 229
   linking to entry fields, 355
   loading (see from statement; import statement; reload())
   Python module, in C, 593
   starting with _ (underscore), 126
vectors, 37-39
virtual inheritance, 856
virtual methods, 854
visual Python, 757

W[ Top ]
Watters, Aaron, 708
Web (see World Wide Web)
while loop, 127-128, 761, 818
whitespace, 50, 101, 654-656
   character escapes for, 119, 774
widgets, 26
windows, 25
   (see also GUI)
Windows port for Python, 722-725
World Wide Web
   getting binaries from, 71
   Python home page, 72
   Python tools for, 718-722, 732-737, 743
WPY system, 738-742
wrapper classes, 421-424, 563-566, 625-630
wrapper modules, 57-60
write(), 118
WWW (see World Wide Web)
wxPython system, 738-742

Y[ Top ]
yacc system, 656


Return to Programming Python