Index

A

abs function, Conversions, Numbers, and Comparisons
__add__ method, An example, Common Operator Overloading Methods
addition operator, Python Expression Operators
Alice, Other Modules and Packages
Amiga Python distributions, Other Platforms
& (bitwise and) operator, Python Expression Operators
and operator, Python Expression Operators, Truth Tests Revisited
append method, Changing lists in place, Changing dictionaries, Making New Lists and Dictionaries: The UserList and UserDict Modules
apply function, The apply Built-in
argument passing, Argument Passing, The gritty details
arbitrary-argument set functions (example), A second example: Arbitrary-argument set functions
assignment, Argument Passing
keywords, defaults (example), A first example
matching modes, Special Argument-Matching Modes
ordering rules, The gritty details
return statement, More on return
arguments, General Form
argv attribute (sys module), Running Module Files, Indexing and slicing
assert statement, The assert Statement
assignment references versus copies, Assignment Creates References, Not Copies
assignment statements, Assignment, Variable Name Rules
forms, Assignment
implicit, Assignment
object references, Assignment
variable name rules, Variable Name Rules
* (multiplication) operator, Python Expression Operators, An example
automated dial-out script, An Automated Dial-Out Script

B

backslash, S tatement delimiters
!= comparison operator, Python Expression Operators
BeOS Python distribution, Other Platforms
binary files, Dealing with Binary Data: The struct Module
binary Python distribution, Installation Overview
bitwise operations, B itwise operations
bitwise operators, Python Expression Operators
blank lines, Common Coding Gotchas
block delimiters, B lock delimiters
books for further reading, Other Published Books
Boolean operators, Truth Tests Revisited
bound instance methods, Methods Are Objects: Bound or Unbound
{} (braces), Dictionaries
[] (brackets), Indexing and slicing, C hanging and formatting, Lists, Changing lists in place, Tuples
break statement, break, continue, pass, and the Loop else
built-in functions, Built-in Functions, Executing Programs
(see also functions)
built-in modules, Library Modules
binary files, Dealing with Binary Data: The struct Module
cgi module, The Common Gateway Interface: The cgi module
debugging, Debugging, Timing, Profiling
Internet data processing, Processing Internet data
Internet protocols, Specific Internet protocols
pickle (see pickle module)
profiling, Debugging, Timing, Profiling
string constants, Basic String Operations: The string Module
string functions, Basic String Operations: The string Module
time module, Debugging, Timing, Profiling
Tkinter (see Tkinter)
urllib, Manipulating URLs: the urllib and urlparse modules
urlparse, Manipulating URLs: the urllib and urlparse modules
built-in object types, Why Use Built-in Types?, Built-in Type Gotchas
__builtins__ namespace, Built-in Functions
bytecode, It’s easy to use, Module Compilation Model

C

C source-code Python distribution, Installation Overview
C++ language, It’s object-oriented, It’s mixable, Component integration
^ (bitwise exclusive or) operator, Python Expression Operators
case-independent sort, Sorting and Randomizing
case sensitivity, names, Variable Name Rules
cgi module, The Common Gateway Interface: The cgi module
CGI scripts, An Automated Complaint System, An Automated Complaint System
GUI programs vs., Design Considerations
chr function, Conversions, Numbers, and Comparisons
class attributes, Class objects provide default behavior
class exceptions, Class Exceptions, Example
class gotchas
changing attributes, Changing Class Attributes Can Have Side Effects, Solution
class function attributes, Class Function Attributes Are Special
methods, classes, nested scopes, Methods, Classes, and Nested Scopes, Solution
multiple inheritance order, Multiple Inheritance: Order Matters
class methods, using (example), Using Class Methods
class statement, Using the Class Statement, Example
class attributes, Class objects provide default behavior
default behavior, Class objects provide default behavior
classes
__add__ method, An example, Common Operator Overloading Methods
built-in objects, extending, Extending Built-in Object Types
designing with OOP, Python and OOP
documentation strings, Documentation Strings
generic object factories, Classes Are Objects: Generic Object Factories
__getattr__ method, __getattr__ catches undefined attribute references
__getitem__ method, __getitem__ intercepts all index references
inheritance, Classes Are Specialized by I nheritance, Multiple Inheritance, An example
__init__ constructor, An example, Example, Specializing Inherited Methods
instance objects, Instance objects are generated from classes
modules, versus, C lasses Versus Modules
__mul__ method, An example
multiple instance objects, Classes Generate Multiple Instance Objects
name mangling, Private Attributes (New in 1.5)
namespace rules, Namespace Rules: The Whole Story
OOP (example), An example
operator overloading, Classes Can Intercept Python Operators, Operator Overloading in Classes, Examples
persistence, OOP and Composition: “has-a”
reasons for, Why Use Classes?
__repr__ method, _ _repr__ returns a string representation
subclasses, Classes Are Specialized by I nheritance
superclasses, Classes Are Specialized by I nheritance
close function, Files
Cmd class, An Interactive Rolodex, An Interactive Rolodex
how works, An Interactive Rolodex
interactive functionality, An Interactive Rolodex
cmp function, Conversions, Numbers, and Comparisons
code
C, Python and, Common Coding Gotchas
column 1, Common Coding Gotchas
modules, Why Use Modules?
reuse, Why Use Functions?
coding gotchas, Common Coding Gotchas
: (colon), Indexing and slicing, C hanging and formatting, Lists, Changing lists in place, Tuples, Python Syntax Rules
colons, compound statements, Common Coding Gotchas
COM framework, Frameworks and Applications, Interfacing with COM: Cheap Public Relations
finding information on, Interfacing with COM: Cheap Public Relations
formletter.py, Interfacing with COM: Cheap Public Relations
command line arguments, How to Run Python Programs, The Interactive Command Line, Running Module Files, Indexing and slicing
comments, Python Syntax Rules
comparing numbers, Conversions, Numbers, and Comparisons
comparison operators, Python Expression Operators
comparisons, Comparisons, Equality, and Truth
compile function, Executing Programs
complex function, Conversions, Numbers, and Comparisons
complex numbers, Standard Numeric Types, Complex numbers
composition, Why Use Classes?, OOP and Composition: “has-a”, OOP and Composition: “has-a”
compound statements pattern, Python Syntax Rules
compounding interest, Compounding Your Interest, Compounding Your Interest
concatenation, Strings
concatenation (+) operator, Python Expression Operators, An example
concept hierarchy, Basic Statements
conferences, Conferences
constructor, class, An example, Example, Specializing Inherited Methods
continue statement, break, continue, pass, and the Loop else
Contributed Modules, Other Modules and Packages
control-flow statements, Python Syntax Rules
control-flows, unusual, Why Use Exceptions?
conversions, Mixed types: Converted up just as in C, Basic operations, C hanging and formatting, Common string tools, Conversions, Numbers, and Comparisons
copy function, Copying Files and Directories: The shutil Module
copy module, Making Copies: The copy Module
copying
copy module, Making Copies: The copy Module
references vs., Changing lists in place, Assignment Creates References, Not Copies, Assignment
counter loops, while Loops, Examples, range and Counter Loops
cPickle, An Automated Complaint System, Digital Creation’s free releases
(see also pickle)
csh shell, Environment Variables
cString, Digital Creation’s free releases
custom sort, Sorting and Randomizing
cyclic data, printing, Cyclic Data Structures Can’t Be Printed

D

data hiding, Data Hiding Is a Convention
data structure manipulation, Data Structure Manipulations
copy module, Making Copies: The copy Module
making copies inline, Changing lists in place, Assignment Creates References, Not Copies, Making Copies Inline
making new lists, dictionaries, Making New Lists and Dictionaries: The UserList and UserDict Modules
making new structures and, Making New Data Structures
sorting, Sorting and Randomizing
sorting, randomizing, Sorting and Randomizing
UserDict class, Making New Lists and Dictionaries: The UserList and UserDict Modules
UserList class, Making New Lists and Dictionaries: The UserList and UserDict Modules
databases, Database programming
dbm files, Dictionary Usage Notes, Related Python Tools
debugging, Default behavior: Error messages, Raising and catching user-defined exceptions
debugging modules, Debugging, Timing, Profiling
declared global, Scope Rules in Functions
def statement, Function Basics, General Form
default arguments, Defaults and Mutable Objects
del statement, Lists, Changing lists in place, Changing dictionaries, Exercises
delattr function, Attribute Manipulation
delegation (OOP), OOP and Delegation
__dict__ attribute, Module Files Are Namespaces, Modules Are Objects: Metaprograms, N amespace Dictionaries
dictionaries
assigning indexes, Dictionary Usage Notes
changing, Changing dictionaries
characteristics of, Dictionaries
common constants, operations, Dictionaries
copying, Making Copies Inline
interfaces, Dictionary Usage Notes
keys, Dictionary Usage Notes
namespace, N amespace Dictionaries
operations, Basic operations
sequence operations, Dictionary Usage Notes
Digital Creations, Digital Creation’s free releases
dir function, A First Look at Namespace Inspection, Built-in Tools, Built-in Functions
directory file manipulation, Filenames and Directories
distributions, The Standard Python Distribution
binary and source forms, Installation Overview
Java, Java
Linux, Unix
Macintosh, Macintosh-Specific Information
other platforms, Other Platforms
Unix, Unix
Windows, Windows-Specific Information
division operator, Python Expression Operators
__doc__ attribute, N amespace Dictionaries
documentation, The Standard Python Documentation Set
COM, Interfacing with COM: Cheap Public Relations
Tkinter, A Tkinter-Based GUI Editor for Managing Form Data
documentation strings, Documentation Strings
DOS/Windows 3.1 Python distributions, Other Platforms
downloading Python distributions, The Standard Python Distribution
downloading web pages, Downloading a Web Page Programmatically
dynamic typing, It’s object-oriented, It’s powerful, Definitions and Calls

E

elif clause, General Format
else (loops), General Format, General Format, break, continue, pass, and the Loop else, General Format
else statement, try/except/else
Emacs, Emacs Support
email processing, Checking Mail
embedding Python in C, Component integration
empty sequences, Comparisons, Equality, and Truth
empty strings, Strings
encapsulation, Python and OOP
environment, Environment Variables
== comparison operator, Python Expression Operators, Comparisons, Equality, and Truth
equality tests, Comparisons, Equality, and Truth, Exceptions Match by Identity, Not Equality
errors (see exceptions)
escaping quotes, String constant variations
eval function, Executing Programs
event notification, Why Use Exceptions?
exception gotchas, Exception Gotchas, Solution
catching too little, Catching Too Little?
catching too much, Catching Too Much?
matching, Exceptions Match by Identity, Not Equality
exceptions, Exceptions, Exercises, Why Use Exceptions?
assert statement, The assert Statement
catching 1-of-N, Catching 1-of-N Exceptions
catching built-in (example), Catching built-in exceptions
class, Class Exceptions, Example
error messages (example), Default behavior: Error messages
finally statement, finally Clauses Run “On the Way Out”
nest at runtime, Exceptions Nest at Runtime
outer try, Outer try Statements Can Debug Code
passing extra data, Passing Optional Data
raising, raise
raw_input, Exceptions Aren’t Always a Bad Thing
reasons for, Why Use Exceptions?
search routine, Searches Sometimes Signal Success by raise
try statement, try Statement Clauses
try/except/else statement, try/except/else
try/finally statement, try/finally
user-defined (example), Raising and catching user-defined exceptions
uses of, Why Use Exceptions?
using vs. not using, finally Clauses Run “On the Way Out”
exec statement, Executing Programs
execfile function, Executing Programs
expression operators, Python Expression Operators
list of, Python Expression Operators
mixed types, Mixed types: Converted up just as in C
overloading, Preview: operator overloading
parentheses, Parentheses group subexpressions
precedence rules, Mixed operators: Operators bind tighter lower in the table
expressions, Expressions
common, Expressions
functions, methods, Expressions
printing values, Expressions
Extending and Embedding, The Standard Python Documentation Set
extending Python with C, It’s mixable
ExtensionClass, Digital Creation’s free releases

F

factories, Classes Are Objects: Generic Object Factories
false objects, Comparisons, Equality, and Truth
FAQ list, The FAQ
feedback.py program, An Automated Complaint System, An Automated Complaint System
file manipulation, Manipulating Files
each line, Doing Something to Each Line in a File
fileinput module, The f ileinput Module
filenames, directories, Filenames and Directories
glob module, Matching Sets of Files: The glob Module, Matching Sets of Files: The glob Module
open and close functions, Files, Files in Action
scanning text files, More on Scanning Text Files, More on Scanning Text Files
set of files, command line, Doing Something to a Set of Files Specified on the Command Line
sys module, Doing Something to Each Line in a File
temporary files, Using Temporary Files
file scanner loops, Examples
fileinput module, The f ileinput Module
filename manipulation, Filenames and Directories
files
basics (example), Files in Action
operations, Files
Python tools, Related Python Tools
filter built-in function, Matching Sets of Files: The glob Module
finally statement, finally Clauses Run “On the Way Out”
find shell command, Calling Other Programs
float function, Conversions, Numbers, and Comparisons
float, C, Conversions, Numbers, and Comparisons
floating-point numbers, Numbers
Fnorb, ILU and Fnorb
for loop, for Loops
example, Examples, Examples
format, General Format
formatting strings, C hanging and formatting
FormEditor program, A Tkinter-Based GUI Editor for Managing Form Data
add_variable, A Tkinter-Based GUI Editor for Managing Form Data
code, A Tkinter-Based GUI Editor for Managing Form Data
feedback.py vs., Design Considerations
for loop block, A Tkinter-Based GUI Editor for Managing Form Data
load_data function, A Tkinter-Based GUI Editor for Managing Form Data
select method, A Tkinter-Based GUI Editor for Managing Form Data
formletter.py program, Interfacing with COM: Cheap Public Relations
forward references, Statement Order Matters in Top-Level Code
frameworks, Classes Are Specialized by I nheritance, Frameworks and Applications, Exercises
COM, Interfacing with COM: Cheap Public Relations, Interfacing with COM: Cheap Public Relations
design considerations, Design Considerations
Numeric Python (NumPy), Numeric Python (NumPy)
Python Imaging Library (PIL), Python Imaging Library (PIL)
Python MegaWidgets (Pmw), Python MegaWidgets (Pmw)
SWIG (Simple Wrapper Interface Generator), SWIG
Swing Java GUI, JPython Gives Python Programmers Access to Java Libraries, A Real JPython/Swing Application: grapher.py
freeware, It’s free
freezing Python, Module Compilation Model
from statement, Usage, Import Model, import and from Are Assignments
general form, General Form
from statement
for assignments, import and from Are Assignments
function gotchas, Function Gotchas
defaults, mutable objects, Defaults and Mutable Objects
nesting, Nested Functions Aren’t Nested Scopes
reference defaults, Using Defaults to Save References
static name detection, Local Names Are Detected Statically, Solution
function results, Common Coding Gotchas
functions, Functions
apply function, The apply Built-in
argument passing, Argument Passing, The gritty details
attribute manipulations, Attribute Manipulation
built-in, Built-in Functions, Executing Programs
call syntax, Common Coding Gotchas
code reuse, Why Use Functions?
comparisons, Conversions, Numbers, and Comparisons
design concepts, Function Design Concepts
example, Example: Intersecting Sequences
executing Python code, Executing Programs
general form of, General Form
global statement, Function Basics, The global Statement
indirect calls, Functions Are Objects: Indirect Calls
inputs, outputs, Function Design Concepts
lambda expressions, lambda Expressions
map function, The map Built-in
numbers, Conversions, Numbers, and Comparisons
object attribute manipulation, Attribute Manipulation
Python procedures, Python “Procedures”
return statement, Function Basics
scope rules in, Scope Rules in Functions
sys module, Aside: The sys Module
type constraints, Function Basics
type conversions, Conversions, Numbers, and Comparisons

I

identity tests, Comparisons, Equality, and Truth, Exceptions Match by Identity, Not Equality
idle (integrated development environment), Gifts from Guido
if statement, if Tests, General Format, Examples
ILU, ILU and Fnorb
imaginary numbers, Complex numbers
immutable sequences, Strings
immutable types, changing, Immutable Types Can’t Be Changed in Place
import statement, Usage, Executing Programs
as assignment, import and from Are Assignments
general form, General Form
importing modules, Usage, Imports Happen Only Once
in operator, Python Expression Operators
indentation, Common Coding Gotchas
indexing, Strings, Indexing and slicing
dictionaries (see dictionaries)
__getitem__ method, __getitem__ intercepts all index references
lists, In dexing and slicing
inheritance, Why Use Classes?, Python and OOP
classes, Classes Are Specialized by I nheritance, Multiple Inheritance, An example
namespace tree construction, Inheritance Searches Namespace Trees
specialization methods, Specializing Inherited Methods, Specializing Inherited Methods
__init__ constructor, An example, Example, Specializing Inherited Methods
installation, binary, C-source code forms, Installation Overview
instance objects, classes, Instance objects are generated from classes
int function, Conversions, Numbers, and Comparisons
integers, Standard Numeric Types, L ong integers, Conversions, Numbers, and Comparisons
integration with C, It’s mixable, Component integration, Embedded Code and Objects, Installation Overview
integration with Java (see Java/JPython)
interactive command line, Python, The Interactive Command Line
interactive prompt >>>, The Interactive Command Line
interactive rolodex, An Interactive Rolodex
interest calculations, Compounding Your Interest, Compounding Your Interest
interest.py program, Compounding Your Interest, Compounding Your Interest
Internet
automated dial-out, An Automated Dial-Out Script
cgi module, The Common Gateway Interface: The cgi module
data processing, Processing Internet data
downloading web pages, Downloading a Web Page Programmatically
protocols, Specific Internet protocols
urllib module, Manipulating URLs: the urllib and urlparse modules
urlparse module, Manipulating URLs: the urllib and urlparse modules
utility modules, Internet scripting
interpreter, defined, How to Run Python Programs
is not operator, Python Expression Operators
is operator, Python Expression Operators, Comparisons, Equality, and Truth
is-a relation, OOP and Inheritance: “is-a”
iteration, Basic operations, while Loops, Examples, The map Built-in, Aside: The sys Module

L

L for long integers, L ong integers
lambda expressions, lambda Expressions
lambda operator, Python Expression Operators
Language Reference, The, The Standard Python Documentation Set
launching Python programs, How to Run Python Programs
< comparison operator, Python Expression Operators
<= comparison operator, Python Expression Operators
<< shift operator, Python Expression Operators
<> comparison operator, Python Expression Operators
len function, Basic operations
LGB rule, Name Resolution: The LGB Rule
Library Reference, The, The Standard Python Documentation Set
Linux Python distributions, Unix
list function, Conversions, Numbers, and Comparisons
lists
basic operations of, Basic operations
changing, in place, Changing lists in place
common constants, operations, Lists
copying, Making Copies Inline
indexing and slicing, In dexing and slicing
main properties of, Lists
local scope, Scope Rules in Functions
logical operators, Python Expression Operators
long function, Conversions, Numbers, and Comparisons
long integers, L ong integers, Conversions, Numbers, and Comparisons
long, C, Conversions, Numbers, and Comparisons
loop else, break, continue, pass, and the Loop else
loops, while Loops, Examples
example, Examples
file scanner, Examples
Lundh, Fredrik, Python Imaging Library (PIL)

M

Macintosh Python distributions, Macintosh-Specific Information
mail servers, Checking Mail
mailing lists, JPython-interest
makepy.py program, Interfacing with COM: Cheap Public Relations
manuals (see documentation)
map function, The map Built-in
mapping, Dictionaries
max function, Conversions, Numbers, and Comparisons
McFarlane, Greg, Python MegaWidgets (Pmw)
Medusa, Other Modules and Packages
membership test (see in operator)
metaprograms, Modules Are Objects: Metaprograms
methods
bound, unbound, Methods Are Objects: Bound or Unbound
names available, Common Operator Overloading Methods
Microsoft’s Common Object Model (COM), Frameworks and Applications, Interfacing with COM: Cheap Public Relations
min function, Conversions, Numbers, and Comparisons
mixed types, expression operators, Mixed types: Converted up just as in C
mixin classes, Multiple Inheritance
module files
defined, Running Module Files
names, A First Look at Module Files
module gotchas, Module Gotchas, Solution
from statement, from Copies Names but Doesn’t Link
import, from statements, Importing Modules by Name String
recursive imports, Recursive “from” Imports May Not Work
reload, reload May Not Impact from Imports
statement order, Statement Order Matters in Top-Level Code
modules, Python Program Structure, Modules, Exercises, Reloading Modules
(see also reloading modules)
classes, versus, C lasses Versus Modules
compilation model, Module Compilation Model
creating, Module Basics
data hiding convention, Data Hiding Is a Convention
defined, Definition
design concepts, Module Design Concepts
import, reload, Module Basics
importing, Imports Happen Only Once
metaprograms, Modules Are Objects: Metaprograms, Modules Are Objects: Metaprograms
__name__ and __main__, Mixed Modes: __name__ and __main__
namespaces, Module Files Are Namespaces, Module Files Are Namespaces
packages, Module Packages (New in 1.5)
PYTHONPATH variable and, Module Basics
roles of, Why Use Modules?
search path, Changing the Module Search Path
shipping options, Module Compilation Model
using, Usage
modulus operator, Python Expression Operators
__mul__ method, An example
multiple inheritance
classes, Multiple Inheritance, Multiple Inheritance
mixin, Multiple Inheritance
order, Multiple Inheritance: Order Matters
multiple-target assignments, Assignment
multiplication operator, Python Expression Operators
mutability, Strings, Mutable types can be changed in place, Immutable Types Can’t Be Changed in Place, Defaults and Mutable Objects

N

names
assignment, Assignment
conventions for, The os and os.path modules, Making New Data Structures
mangling, Private Attributes (New in 1.5)
module files, A First Look at Module Files
namespace, A First Look at Namespace Inspection
qualification, Name Qualification
reference, Assignment
variable, rules, Variable Name Rules
namespaces, Scope Rules in Functions
(see also scopes)
built-in functions, Attribute Manipulation
class statement (example), Example
dictionaries, N amespace Dictionaries
LGB rule, Name Resolution: The LGB Rule
modules, Why Use Modules?, Module Files Are Namespaces, Module Files Are Namespaces
names, A First Look at Namespace Inspection
qualified names, Qualified Names: Object Namespaces
tree construction, Attribute Tree Construction
unqualified names, Unqualified Names: Global Unless Assigned
negation operator, Python Expression Operators
nested blocks, Python Syntax Rules
nesting scopes, Nested Functions Aren’t Nested Scopes
newsgroups, comp.lang.python/python-list
None object, Changing lists in place, Comparisons, Equality, and Truth, Examples, Common Coding Gotchas, Python “Procedures”
not in operator, Python Expression Operators
not operator, Python Expression Operators, Truth Tests Revisited
numbers, Conversions, Numbers, and Comparisons
numeric conversion (in expressions), C hanging and formatting
numeric objects
basic operations, Numbers in Action
bitwise operations, B itwise operations
built-in tools, Other numeric tools
built-in tools, extensions, Built-in Tools and Extensions
complex numbers, Complex numbers
long integers, L ong integers
standard, Standard Numeric Types
numeric precision, Standard Numeric Types
numeric programming, Numeric programming
Numeric Python (NumPy), Numeric Python (NumPy)
NumPy numeric programming extension, Numeric programming

O

object-oriented programming (see OOP)
object persistence, OOP and Composition: “has-a”
object reference
creation, Assignment
functions, Function Basics
Object Request Broker service, Interfacing with COM: Cheap Public Relations, ILU and Fnorb
object type
conversions, Conversions, Numbers, and Comparisons
extending (classes), Extending Built-in Object Types
numbers, Numbers
objects, Python Program Structure
classification, Type Categories Revisited
comparisons, Comparisons, Equality, and Truth
equality tests, Comparisons, Equality, and Truth
factories, Classes Are Objects: Generic Object Factories
lists, Lists
methods (bound, unbound), Methods Are Objects: Bound or Unbound
shared references, Shared References
truth, Comparisons, Equality, and Truth
oct function, Conversions, Numbers, and Comparisons
octal constants, Standard Numeric Types
OOP (object-oriented programming), It’s object-oriented
class objects, instance objects, Classes Generate Multiple Instance Objects
classes (example), Classes Generate Multiple Instance Objects, An example
composition (has-a), OOP and Composition: “has-a”, OOP and Composition: “has-a”
delegation, OOP and Delegation
designing with, Python and OOP
factories, Classes Are Objects: Generic Object Factories
inheritance (is-a), OOP and Inheritance: “is-a”
open function, Files, Files in Action
open pairs rule, A few special cases
open source software, It’s free
OpenVMS Python distributions, Other Platforms
operator overloading, Operator Overloading in Classes, Examples
classes, Classes Can Intercept Python Operators
methods sampling, Common Operator Overloading Methods
operator precedence rules, Mixed operators: Operators bind tighter lower in the table
or operator, Python Expression Operators, Truth Tests Revisited
ord function, Conversions, Numbers, and Comparisons
os module, The os and os.path modules, The os and os.path modules, Interfacing with COM: Cheap Public Relations
attribute definition, The os and os.path modules
functions (frequently used), The os and os.path modules
string attributes, The os and os.path modules
os.environ dictionary, The os and os.path modules
os.error, The os and os.path modules
os.listdir function, Filenames and Directories
os.name, The os and os.path modules
os.path module, functions, The os and os.path modules
os.popen, Calling Other Programs
os.rename function, Filenames and Directories
os.system(), Calling Other Programs
Ousterhout, John, A Tkinter-Based GUI Editor for Managing Form Data
outer try, Outer try Statements Can Debug Code

P

packages, Module Packages (New in 1.5)
parameters, General Form
parentheses in expressions, Parentheses group subexpressions
pass statement, break, continue, pass, and the Loop else
PATH variable, Environment Variables
% (remainder/format) operator, Python Expression Operators
... prompt, Examples
Perl language, Python Versus Similar Tools
persistence, OOP and Composition: “has-a”
Peters, Tim, Tim Peters
pickle module, Database programming, OOP and Composition: “has-a”, An Automated Complaint System, Interfacing with COM: Cheap Public Relations
+ (addition/concatenation) operator, Python Expression Operators, An example
+ (identity) operator, Python Expression Operators
polymorphism, Python and OOP
portability, GUIs
portable ANSI C, It’s portable
POSIX conventions, The os and os.path modules
precedence rules (operators), Mixed operators: Operators bind tighter lower in the table
print statement, Print
forms, Print
writing to sys.stdout, The Python “Hello World” Program
private names, Data Hiding Is a Convention
procedures, Python functions, Python “Procedures”
profile module, Debugging, Timing, Profiling
program manipulation
calling other programs, Calling Other Programs, Calling Other Programs
os.popen, Calling Other Programs
os.system(), Calling Other Programs
program structure, Python Program Structure
Programming Python (Lutz), Other Published Books
prompts, input (...), The Interactive Command Line
prompts, input (>>>), The Interactive Command Line
prototyping, Rapid prototyping
Psion Series 5 Python distributions, Other Platforms
.py files, Module Compilation Model
.pyc bytecode, Module Compilation Model
.pyc files, Module Compilation Model
PyModules FAQ, Other Modules and Packages
Python Consortium, The Standard Python Distribution
Python distributions, The Standard Python Distribution
Python Imaging Library (PIL), Python Imaging Library (PIL)
Python Language web site, The Python Language Web Site
Python MegaWidgets (Pmw), Python MegaWidgets (Pmw)
Python Pocket Reference (Lutz), Other Published Books
Python Software Association, The Standard Python Distribution
Python source tree, Gifts from Guido
Python/C API, The Standard Python Documentation Set
PYTHONPATH variable, Environment Variables, Module Basics
PYTHONSTARTUP variable, Environment Variables
Pythonware, Pythonware

Q

QNX Python distributions, Other Platforms
qualification, name, Name Qualification, Qualified Names: Object Namespaces
__getattr__ method, __getattr__ catches undefined attribute references
' (quotation mark) for strings, Strings
" (quotation mark) for strings, Strings

R

raise statement, raise, General raise forms
random module, Randomizing: The random Module
range function, range and Counter Loops
raw_input function, Exceptions Aren’t Always a Bad Thing
raw strings, String constant variations
re module, Advanced String Operations: The re Module, A real regular expression problem
re.compile() (strings), A real regular expression problem
read stdin, Doing Something to a Set of Files Specified on the Command Line
readlines method (scanning text files), More on Scanning Text Files
recursive functions, Nested Functions Aren’t Nested Scopes
recursive imports, Recursive “from” Imports May Not Work
redirecting input/output, The Python “Hello World” Program
references, copying vs., Changing lists in place, Assignment Creates References, Not Copies, Assignment
regular expressions (strings), Advanced String Operations: The re Module, A real regular expression problem
reloading modules, A First Look at Module Files, Reloading Modules
example, Example
general form, General Form
remainder operator, Python Expression Operators
repetition operator, Python Expression Operators
repetition, one-level deep, Repetition Adds One-Level Deep
__repr__ method, _ _repr__ returns a string representation
reserved words, Variable Name Rules
resources, Python Resources, Tim Peters
documentation (see documentation)
return statement, Function Basics
argument passing, More on return
function results, Common Coding Gotchas
> comparison operator, Python Expression Operators
>= comparison operator, Python Expression Operators
>> shift operator, Python Expression Operators
>>> (input prompt), The Interactive Command Line
running Python
embedded code, objects, Embedded Code and Objects
interactive command line, The Interactive Command Line
interpreter, How to Run Python Programs
module files, Running Module Files
Unix-style scripts, Running Unix-Style Scripts

S

scanning text files, More on Scanning Text Files, More on Scanning Text Files
if __name__ == “__main__” trick, More on Scanning Text Files
readlines method, More on Scanning Text Files
value key, More on Scanning Text Files
scopes, Scope Rules in Functions, Operator Overloading in Classes, Namespace Rules: The Whole Story
(see also namespaces)
example, Example
illustration, Name Resolution: The LGB Rule
LGB rule, Name Resolution: The LGB Rule
nesting, Nested Functions Aren’t Nested Scopes
Scriptics Corporation, Scriptics Corporation’s Tcl/Tk toolkits
scripting, Internet scripting
scripting languages, It’s powerful
sequences, Strings
setattr function, Attribute Manipulation
shared object references, Shared References
shelve module, OOP and Composition: “has-a”
shift operators, Python Expression Operators
shipping options, Module Compilation Model
short-circuit evaluation, Truth Tests Revisited
shutil module, Copying Files and Directories: The shutil Module
SIGs (special interest groups), The SIGs
size, object, Basic operations
/ (division) operator, Python Expression Operators
slicing, Strings, Indexing and slicing
lists, In dexing and slicing
sort method, Changing lists in place, Sorting and Randomizing
source distributions (see distributions)
spaces in programs, Python Syntax Rules
special interest groups (SIGs), The SIGs
Starship Python, The Standard Python Distribution
startup script (example), An Example Startup Script
statements, Python Program Structure
assignment, Assignment, Variable Name Rules
defined, Basic Statements
delimiters for, S tatement delimiters
expressions, Expressions
summary, Basic Statements
syntax rules, Python Syntax Rules
truth tests, Truth Tests Revisited
Stein, Greg, Interfacing with COM: Cheap Public Relations
str function, Conversions, Numbers, and Comparisons
string module, Common string tools, Advanced String Operations: The re Module
constants, Basic String Operations: The string Module
defining parts of, A real regular expression problem
functions, Basic String Operations: The string Module
regular expressions problem, A real regular expression problem
replacement operation, A real regular expression problem
string.find, Calling Other Programs
strings
changing, formatting, C hanging and formatting
common tools, Common string tools
constant variations, String constant variations
constants, operations, Strings
defined, Strings
documentation (classes), Documentation Strings
formatting codes, C hanging and formatting
indexing, Indexing and slicing
operation basics, Basic operations
raw, String constant variations
slicing, Indexing and slicing
struct module, Dealing with Binary Data: The struct Module
format codes, Dealing with Binary Data: The struct Module
subclasses, Classes Are Specialized by I nheritance
subtraction operator, Python Expression Operators
superclasses, Classes Are Specialized by I nheritance
SWIG (Simple Wrapper Interface Generator), SWIG
Swing Java GUI toolkit, Frameworks and Applications
syntax rules
backslash, S tatement delimiters
block delimiters, B lock delimiters
block, statement boundaries, Python Syntax Rules
compound statements, Python Syntax Rules
execution sequence, Python Syntax Rules
open pairs, A few special cases
spaces, comments, Python Syntax Rules
statement delimiters, S tatement delimiters
statements, Python Syntax Rules
variable names, Variable Name Rules
sys module, Aside: The sys Module
sys.argv, Aside: The sys Module
sys.modules, Aside: The sys Module
sys.modules dictionary, Modules Are Objects: Metaprograms
sys.path, Aside: The sys Module
sys.path dictionary, Changing the Module Search Path
sys.platform, Aside: The sys Module
sys.ps1, Aside: The sys Module
sys.ps2, Aside: The sys Module
sys.stderr, Doing Something to Each Line in a File
sys.stdin, Doing Something to Each Line in a File
sys.stdout, The Python “Hello World” Program, Doing Something to Each Line in a File
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset