★ wanayoo — archive 1999 http://www.ora.com/catalog/lpython/inx.htmlNouvelle recherche | Portail wanayoo
Search the Catalog

Learning Python

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 ], 
[ X ], 
[ Z ], 



Symbols[ Top ]
& (bitwise and) operator, 30
* (multiplication) operator, 31, 157
!= comparison operator, 30
{ } (braces), 51
[ ] (brackets), 38-40, 45-48, 55
^ (bitwise exclusive or) operator, 30
: (colon), 38-40, 45-48, 55, 80
== comparison operator, 30, 61
- (subtraction) operator, 31
- (unary negation) operator, 31
< comparison operator, 30
<= comparison operator, 30
<< shift operator, 31
<> comparison operator, 30
% (remainder/format) operator, 31
... prompt, 92
+ (addition/concatenation) operator, 31, 157
+ (identity) operator, 31
' (quotation mark) for strings, 36
" (quotation mark) for strings, 36
> comparison operator, 30
>= comparison operator, 30
>> shift operator, 31
>>> (input prompt), 12
/ (division) operator, 31
~ (bitwise complement) operator, 31
| (bitwise or) operator, 30

A[ Top ]
abs function, 219
_ _add_ _ method, 157, 165
addition operator, 31
Alice, 315
Amiga Python distributions, 325
and operator, 30, 83
append method, 48, 52, 249
apply function, 112
argument passing, 105-110
      arbitrary-argument set functions (example), 109
      assignment, 105
      keywords, defaults (example), 108
      matching modes, 107
      ordering rules, 110
      return statement, 107
arguments, 99
argv attribute (sys module), 13, 39
assert statement, 206
assignment references versus copies, 63
assignment statements, 71-74
      forms, 72
      implicit, 72
      object references, 72
      variable name rules, 73
automated dial-out script, 268

B[ Top ]
backslash, 81
BeOS Python distribution, 325
binary files, 237
binary Python distribution, 23
bitwise operations, 33
bitwise operators, 30
blank lines, 93
block delimiters, 80
books for further reading, 317
Boolean operators, 82
bound instance methods, 180
break statement, 85
built-in functions, 217-224
      (see also functions)
built-in modules, 224
      binary files, 237
      cgi module, 235
      debugging, 239
      Internet data processing, 237
      Internet protocols, 236
      pickle (see pickle module)
      profiling, 241
      string constants, 226
      string functions, 224
      time module, 240
      Tkinter (see Tkinter)
      urllib, 235
      urlparse, 236
built-in object types, 28, 63
_ _builtins_ _ namespace, 217
bytecode, 6, 137

C[ Top ]
C++ language, 4, 6, 8
C source-code Python distribution, 23
case-independent sort, 246
case sensitivity, names, 73
CGI module, 54
cgi module, 235
CGI scripts, 276-282
      GUI programs vs., 294
chr function, 219-220
class attributes, 152
class exceptions, 206-208
class gotchas
      changing attributes, 183-184
      class function attributes, 185
      methods, classes, nested scopes, 187-189
      multiple inheritance order, 185
class methods, using (example), 160
class statement, 158-160
      class attributes, 152
      default behavior, 152
classes
      _ _add_ _ method, 157, 165
      built-in objects, extending, 175
      designing with OOP, 170
      documentation strings, 181
      generic object factories, 179
      _ _getattr_ _ method, 167
      _ _getitem_ _ method, 166
      inheritance, 154-179
      _ _init_ _ constructor, 157, 160, 163
      instance objects, 153
      modules, versus, 182
      _ _mul_ _ method, 158
      multiple instance objects, 152
      name mangling, 181
      namespace rules, 168
      OOP (example), 153
      operator overloading, 59, 156, 164-166
      persistence, 174
      reasons for, 151
      _ _repr_ _ method, 167
      subclasses, 154
      superclasses, 155
close function, 57
Cmd class, 270-272
      how works, 273
      interactive functionality, 271
cmp function, 219
code
      C, Python and, 93
      column 1, 93
      modules, 127
      reuse, 97
coding gotchas, 92
colons, compound statements, 92
COM framework, 275, 282
      finding information on, 287
      formletter.py, 283
command line arguments, 11-13, 39
comments, 80
comparing numbers, 218-219
comparison operators, 30
comparisons, 61
compile function, 222
complex function, 220
complex numbers, 29, 34
composition, 151, 172-174
compound statements pattern, 80
compounding interest, 267-268
concatenation, 35
concatenation (+) operator, 31, 157
concept hierarchy, 70
conferences, 319
constructor, class, 157, 160, 163
continue statement, 85
Contributed Modules, 314
control-flow statements, 79
control-flows, unusual, 195
conversions, 31, 37, 40-42, 218
copy function, 234
copy module, 245
copying
      copy module, 245
      references vs., 48, 63, 72
counter loops, 84, 90-92
cPickle, 313
      (see also pickle)
csh shell, 21
cString, 313
custom sort, 246
cyclic data, printing, 65

D[ Top ]
data hiding, 137
data structure manipulation, 243
      copy module, 245
      making copies inline, 48, 63, 243
      making new lists, dictionaries, 248
      making new structures and, 247
      sorting, 246
      sorting, randomizing, 246
      UserDict class, 248
      UserList class, 248
databases, 9
dbm files, 54, 57
debugging, 198-199
debugging modules, 239
declared global, 102
def statement, 98-99
default arguments, 122
del statement, 46, 49, 52, 67
delattr function, 221
delegation (OOP), 174
_ _dict_ _ attribute, 129, 131, 141, 169
dictionaries
      assigning indexes, 53
      changing, 51
      characteristics of, 49
      common constants, operations, 50
      copying, 244
      interfaces, 54
      keys, 53
      namespace, 169
      operations, 51
      sequence operations, 53
Digital Creations, 313
dir function, 18-19, 216-217
directory file manipulation, 254
distributions, 309
      binary and source forms, 23
      Java, 325
      Linux, 321
      Macintosh, 323
      other platforms, 325
      Unix, 321
      Windows, 323
division operator, 31
_ _doc_ _ attribute, 169
documentation, 316
      COM, 287
      Tkinter, 293
documentation strings, 181
DOS/Windows 3.1 Python distributions, 325
downloading Python distributions, 309
downloading web pages, 265
dynamic typing, 4-5, 100

E[ Top ]
elif clause, 78
else (loops), 78, 84-85, 88
else statement, 196
Emacs, 315
email processing, 266
embedding Python in C, 8
empty sequences, 61
empty strings, 36
encapsulation, 170
environment, 20
equality tests, 61, 209
errors (see exceptions)
escaping quotes, 42
eval function, 222
event notification, 195
exception gotchas, 208-211
      catching too little, 210
      catching too much, 209
      matching, 209
exceptions, 194-212
      assert statement, 206
      catching 1-of-N, 202
      catching built-in (example), 199
      class, 206-208
      error messages (example), 198
      finally statement, 203
      nest at runtime, 202
      outer try, 200
      passing extra data, 204
      raising, 197
      raw_input, 200
      reasons for, 194
      search routine, 200
      try statement, 201
      try/except/else statement, 196
      try/finally statement, 197
      user-defined (example), 199
      uses of, 195
      using vs. not using, 205
exec statement, 222
execfile function, 222-223
expression operators, 30
      list of, 30
      mixed types, 31
      overloading, 32
      parentheses, 31
      precedence rules, 31
expressions, 74
      common, 75
      functions, methods, 74
      printing values, 75
Extending and Embedding, 316
extending Python with C, 6
ExtensionClass, 313

F[ Top ]
factories, 179
false objects, 61
FAQ list, 316
feedback.py program, 276-282
feedbackeditor.py program, 289
file manipulation, 249
      each line, 250
      fileinput module, 253
      filenames, directories, 254
      glob module, 255-257
      open and close functions, 56-57
      scanning text files, 259-262
      set of files, command line, 252
      sys module, 250
      temporary files, 258
file scanner loops, 91
fileinput module, 253
filename manipulation, 254
files
      basics (example), 57
      operations, 56
      Python tools, 57
filter built-in function, 256
finally statement, 203
find shell command, 264
float, C, 218
float function, 220
floating-point numbers, 28
Fnorb, 304
for loop, 87
      example, 88-90
      format, 87
formatting strings, 40
FormEditor program, 288
      add_variable, 291
      code, 289
      feedback.py vs., 294
      for loop block, 291
      load_data function, 291, 293
      select method, 292
formletter.py program, 283
forward references, 145
frameworks, 155, 275-305
      COM, 282-288
      design considerations, 294
      Numeric Python (NumPy), 302
      Python Imaging Library (PIL), 302
      Python MegaWidgets (Pmw), 304
      SWIG (Simple Wrapper Interface Generator), 303
      Swing Java GUI, 296-302
freeware, 4
freezing Python, 138
from statement, 128-129, 132
      for assignments, 132
      general form, 134
function gotchas, 117
      defaults, mutable objects, 122
      nesting, 118
      reference defaults, 120
      static name detection, 117-118
function results, 93
functions, 97-125
      apply function, 112
      argument passing, 105-110
      attribute manipulations, 221
      built-in, 217-224
      call syntax, 93
      code reuse, 97
      comparisons, 218
      design concepts, 115
      example, 100
      executing Python code, 222
      general form of, 99
      global statement, 98, 104
      indirect calls, 116
      inputs, outputs, 115
      lambda expressions, 111
      map function, 113
      numbers, 218
      object attribute manipulation, 221
      Python procedures, 114
      return statement, 98
      scope rules in, 101
      sys module, 216
      type constraints, 99
      type conversions, 218-219

G[ Top ]
Gadfly, 315
garbage collection, 5, 57
_ _getattr_ _ method, 167
getattr function, 221
_ _getitem_ _ method, 166
glob module, 255-257
global scope, 102
global statement, 98, 104
gotchas
      built-in object types, 63
      class, 183-189
      coding, 92
      exception, 208-211
      function, 117-123
      module, 143-148
      (see also specific type)
grapher.py, 297, 301
GUI programming, 7
      design considerations, 294
      Tkinter test, 22
      (see also JPython; Tk; Tkinter)

H[ Top ]
Hammond, Mark, 282
has-a relation, 172-174
hasattr function, 221
hello world program, 76
hex function, 220
hexadecimal constants, 29
HTML, 8, 265, 276
Hugunin, Jim, 294, 302

I[ Top ]
identity tests, 61, 209
idle (integrated development environment), 311
if statement, 77-78
ILU, 304
imaginary numbers, 34
immutable sequences, 35
immutable types, changing, 65
import statement, 128, 222
      as assignment, 132
      general form, 134
importing modules, 128, 132
in operator, 30
indentation, 93
indexing, 36-38
      dictionaries (see dictionaries)
      _ _getitem_ _ method, 166
      lists, 47
inheritance, 151, 170
      classes, 154-179
      namespace tree construction, 161
      specialization methods, 162-164
_ _init_ _ constructor, 157, 160, 163
installation, binary, C-source code forms, 23
instance objects, classes, 153
int function, 218, 220
integers, 29, 34, 218
integration with C, 6, 8, 16, 23
integration with Java (see Java/JPython)
interactive command line, Python, 12
interactive prompt >>>, 12
interactive rolodex, 269
interest calculations, 267-268
interest.py program, 267-268
Internet
      automated dial-out, 268
      cgi module, 235
      data processing, 237
      downloading web pages, 265
      protocols, 236
      urllib module, 235
      urlparse module, 236
      utility modules, 8
interpreter, defined, 10
is not operator, 30
is operator, 30, 61
is-a relation, 170
iteration, 37, 84-92, 114, 217

J[ Top ]
J suffix for imaginary numbers, 34
Java/JPython, 294
      distribution, 325
      installation, 294
      Java libraries, 295
      Java scripting, 296
      Java, versus, 302
      swing application, grapher.py, 297

K[ Top ]
keyword arguments, 108, 111
ksh shell, 21

L[ Top ]
L for long integers, 34
lambda expressions, 111, 113
lambda operator, 30
Language Reference, The, 316
launching Python programs, 11
len function, 37
LGB rule, 102
Library Reference, The, 316
Linux Python distributions, 321
list function, 220
lists
      basic operations of, 46
      changing, in place, 47
      common constants, operations, 45
      copying, 243
      indexing and slicing, 47
      main properties of, 44
local scope, 102
logical operators, 30
long, C, 218
long function, 220
long integers, 34, 218
loop else, 85
loops, 84-92
      example, 91
Lundh, Fredrik, 302

M[ Top ]
Macintosh Python distributions, 323
mail servers, 266
mailing lists, 319
makepy.py program, 285
manuals (see documentation)
map function, 113
mapping, 50
max function, 221
McFarlane, Greg, 304
Medusa, 315
membership test (see in operator)
metaprograms, 141
methods
      bound, unbound, 180
      names available, 165
Microsoft's Common Object Model (COM), 275, 282
min function, 220
mixed types, expression operators, 31
mixin classes, 177
module files, 13
      names, 17
module gotchas, 143-148
      from statement, 144
      import, from statements, 143
      recursive imports, 146
      reload, 147
      statement order, 145
modules, 26, 126-149
      classes, versus, 182
      compilation model, 137
      creating, 127
      data hiding convention, 137
      defined, 128
      design concepts, 141
      import, reload, 127
      importing, 132
      metaprograms, 141-143
      _ _name_ _ and _ _main_ _, 138
      namespaces, 129-131
      packages, 140
      PYTHONPATH variable and, 128
      roles of, 126
      search path, 139
      shipping options, 138
      using, 128
      (see also reloading modules)
modulus operator, 31
_ _mul_ _ method, 158
multiple inheritance
      classes, 176-179
      mixin, 177
      order, 185
multiple-target assignments, 73
multiplication operator, 31
mutability, 35, 44, 65, 122

N[ Top ]
names
      assignment, 72
      conventions for, 231, 248
      mangling, 181
      module files, 17
      namespace, 18
      qualification, 131
      reference, 72
      variable, rules, 73
namespaces, 101
      built-in functions, 221
      class statement (example), 159
      dictionaries, 169
      LGB rule, 102
      modules, 127, 129-131
      names, 18
      qualified names, 168
      tree construction, 161
      unqualified names, 168
      (see also scopes)
negation operator, 30
nested blocks, 79
nesting scopes, 118
newsgroups, 318
None object, 49, 61, 86, 93, 114
not operator, 30, 83
not in operator, 30
numbers, 218
numeric conversion (in expressions), 40
numeric objects
      basic operations, 32
      bitwise operations, 33
      built-in tools, 35
      built-in tools, extensions, 29
      complex numbers, 34
      long integers, 34
      standard, 28
numeric precision, 29
numeric programming, 8
Numeric Python (NumPy), 302
NumPy numeric programming extension, 8

O[ Top ]
object-oriented programming (see OOP)
object persistence, 174
object reference
      creation, 72
      functions, 99
Object Request Broker service, 282, 304
object type
      conversions, 218
      extending (classes), 175
      numbers, 28
objects, 26
      classification, 58
      comparisons, 61
      equality tests, 61
      factories, 179
      lists, 44
      methods (bound, unbound), 180
      shared references, 60
      truth, 61
oct function, 220
octal constants, 29
OOP (object-oriented programming), 4
      class objects, instance objects, 152
      classes (example), 152-153
      composition (has-a), 172-174
      delegation, 174
      designing with, 170
      factories, 179
      inheritance (is-a), 170
open function, 56-57
open pairs rule, 82
open source software, 4
OpenVMS Python distributions, 325
operator overloading, 59, 164-166
      classes, 156
      methods sampling, 165
operator precedence rules, 31
or operator, 30, 83
ord function, 219-220
os module, 231-234, 284
      attribute definition, 232
      functions (frequently used), 231
      string attributes, 232
os.environ dictionary, 232
os.error, 232
os.listdir function, 254
os.name, 232
os.path module, functions, 233
os.popen, 263
os.rename function, 254
os.system( ), 262
Ousterhout, John, 288
outer try, 200

P[ Top ]
packages, 140
parameters, 99
parentheses in expressions, 31
pass statement, 85
PATH variable, 20
Perl language, 10
persistence, 174
Peters, Tim, 320
pickle module, 9, 174, 281, 284
polymorphism, 170
portability, 7
portable ANSI C, 4
POSIX conventions, 231
precedence rules (operators), 31
print statement, 75
      forms, 76
      writing to sys.stdout, 77
private names, 138
procedures, Python functions, 114
profile module, 241
program manipulation
      calling other programs, 262-264
      os.popen, 263
      os.system( ), 262
program structure, 26
Programming Python (Lutz), 317
prompts, input (...), 13
prompts, input (>>>), 12
prototyping, 8
Psion Series 5 Python distributions, 325
.py files, 137
.pyc bytecode, 138
.pyc files, 137
PyModules FAQ, 314
Python Consortium, 311
Python distributions, 309
Python Imaging Library (PIL), 302
Python Language web site, 309
Python MegaWidgets (Pmw), 304
Python Pocket Reference (Lutz), 317
Python Software Association, 309
Python source tree, 311
Python/C API, 316
PYTHONPATH variable, 20, 128
PYTHONSTARTUP variable, 20
Pythonware, 314

Q[ Top ]
QNX Python distributions, 325
qualification, name, 131, 168
      _ _getattr_ _ method, 167

R[ Top ]
raise statement, 197, 207
random module, 247
range function, 90-92
raw_input function, 200
raw strings, 43
re module, 227-230
read stdin, 252
readlines method (scanning text files), 260
re.compile( ) (strings), 229
recursive functions, 119
recursive imports, 146
redirecting input/output, 77
references, copying vs., 48, 63, 72
regular expressions (strings), 227-230
reloading modules, 17, 133
      example, 135
      general form, 134
remainder operator, 31
repetition, one-level deep, 64
repetition operator, 31
_ _repr_ _ method, 167
reserved words, 74
resources, 309-320
      documentation (see documentation)
return statement, 98
      argument passing, 107
      function results, 93
running Python
      embedded code, objects, 15
      interactive command line, 12
      interpreter, 11
      module files, 13
      Unix-style scripts, 14

S[ Top ]
scanning text files, 259-262
      if _ _name_ _ == "_ _main_ _" trick, 261
      readlines method, 260
      value key, 259
scopes, 102, 168
      example, 103
      illustration, 103
      LGB rule, 102
      nesting, 118
      (see also namespaces)
Scriptics Corporation, 313
scripting, 8
scripting languages, 5
sequences, 35
setattr function, 221
shared object references, 60
shelve module, 174
shift operators, 31
shipping options, 138
short-circuit evaluation, 83
shutil module, 234
SIGs (special interest groups), 318
size, object, 37
slicing, 35, 37, 39
      lists, 47
sort method, 48, 246
source distributions (see distributions)
spaces in programs, 80
special interest groups (SIGs), 318
Starship Python, 311
startup script (example), 21
statements, 26
      assignment, 71-74
      defined, 70
      delimiters for, 81
      expressions, 74
      summary, 71
      syntax rules, 79
      truth tests, 82
Stein, Greg, 282
str function, 220
string module, 41, 227
      constants, 226
      defining parts of, 228
      functions, 224
      regular expressions problem, 227
      replacement operation, 229
string.find, 263
strings
      changing, formatting, 40
      common tools, 41
      constant variations, 42
      constants, operations, 36
      defined, 35
      documentation (classes), 181
      formatting codes, 41
      indexing, 37-38
      operation basics, 36
      raw, 43
      slicing, 37, 39
struct module, 237-238
subclasses, 154
subtraction operator, 31
superclasses, 155
SWIG (Simple Wrapper Interface Generator), 303
Swing Java GUI toolkit, 275
syntax rules
      backslash, 81
      block delimiters, 80
      block, statement boundaries, 79
      compound statements, 80
      execution sequence, 79
      open pairs, 82
      spaces, comments, 80
      statement delimiters, 81
      statements, 79
      variable names, 73
sys module, 216
sys.argv, 216
sys.modules, 216
sys.modules dictionary, 141
sys.path, 139, 216 [_IX-1_]
sys.platform, 216
sys.ps1, 216
sys.ps2, 216
sys.stderr, 250
sys.stdin, 250
sys.stdout, 77, 250

T[ Top ]
tempfile module, 281
temporary files, 258
time module, 240, 281
Tk/Tkinter, 7, 275, 288-293
      documentation, 293
      environment setting, 21
      GUI (graphical user interface), 275
      testing, 22
truth, 62
truth tests, 82
try statement, 201
      try/except/else statement, 196
      try/finally statement, 197
tuple function, 220
tuples
      assignment, 72
      constants, operations, 54
      copying, 243
      defined, 53
      properties of, 53
      sorting contents of, 246
turtle.py, 315
Tutorial, The Python, 316
type collection tuples, 53
types
      categories of, 43
      converting, 31, 219
            (see also conversions)
      files, 56
      hierarchies, 63
      mutable, 44
      reasons for built-in, 27

U[ Top ]
unary operators, 31
unbound class methods, 180
Unix extensions, 322
Unix Python distributions, 321
Unix-like system scripts, 14
unpacking assignments, 72
urllib module, 235
urlparse module, 236
URLs, urllib module, 235
UserDict class, 248
UserList class, 248
users list, 9, 311, 317-319

V[ Top ]
van Rossum, Guido, 294, 302, 311
variable name rules, 73
VxWorks Python distributions, 325

W[ Top ]
web pages
      cgi module, 235
      checking links, 266
      downloading programmatically, 265
      email processing, 266
      webchecker.py (management), 266
web site resources, xiii, 317
      Alice, 315
      Contributed Modules, 314
      Emacs, 315
      FAQ, 316
      Gadfly, 315
      Medusa, 315
      PyModules FAQ, 314
      Python distribution, 309
      Python Language, 309
      Scriptics Corporation, 313
      Starship Python, 311
while loop, 84-86
whrandom module, 247
win32com, 282, 286
      Dispatch function, 284
      formletter.py program, 283
      information resources, 286
      Word.Application.8, 284
Windows CE Python distributions, 325
Windows Python distributions, 323
Word.Application.8, 284

X[ Top ]
XML, 5, 8, 265

Z[ Top ]
Zope, 294, 314




Return to Learning Python


O'Reilly Home | O'Reilly Bookstores | How to Order | O'Reilly Contacts
International | About O'Reilly | Affiliated Companies

© 2000, O'Reilly & Associates, Inc.