Beginning Python - From Novice to Professional

Beginning Python - From Novice to Professional Beginning Python - From Novice to Professional

16.01.2014 Views

■INDEX 599 split function re module 239, 240 Sprite class pygame.sprite module 530 sqrt function 18 math module 554 Stackless Python alternative Python distribution 6 StandardError exception class 287 start method adding to handler superclass 398 Match Objects 242 start_paragraph method adding to handler superclass 398 statements 14–15 assignment statements 83–85 blocks 85–86 conditional statements 86–87 elif clauses 88 else clauses 87 if statements 87 nesting blocks 88 conditions 86 assertions 93 boolean statements 91–92 comparison operators 89–91 del statements 103–104 eval statements 105–106 exec statements 104–105 if statements 16 import statements 82–83 loops 93–94 breaking out of 98–100 for loops 95 iterating over dictionaries 96 iteration utilities 96–98 while loops 94 pass statements 102 print statements 14, 16 using with commas 81–82 static methods creating with staticmethod objects 187 stderr variable sys module 215, 258 stdin variable iteratorability of 266 sys module 215, 258 stdout class sys module 215, 258 write method 310 StopIteration exception 190 str function 25, 561 StreamRequestHandler class 303 strftime function time module 227, 441 string formatting dictionaries 71, 72 string module 501 Template class 72 template strings 54 values from 60 string representations 25 strings comparing strings and sequences 91 concatenating strings 24 input compared to raw_input 26 long strings 27 methods 563–565 raw strings 27, 28 single-quoted strings and escaping quotes 23–24 string formatting 53–56 conversion types 56–57 signs, alignment, and zero-padding 58–59 simple conversion 56 width and precision 57

600 ■INDEX string methods 59–60 find method 60–61 join method 61–62 lower method 62 replace method 62 split method 63 strip method 63 translate method 64–65 string representations 25 Unicode strings 29 strip method 63 strptime function time module 227 sub method adding to handler superclass 398 sub function re module 239, 240 subclassing built-in classes 173 list, dict, and str 182–184 subprocess module running the Tidy program 317 using command-line tools 352 subprocess module speeding up programs 361 substitutions using group numbers and functions in 242–243 sum function 561 sunspots example creating line diagram from data 411 first implementation 413 constructing some polylines 415 drawing with ReportLab 413–414 prototype 416 preparations 412 second implementation 417 getting the data 417–418 using LinePlot class 418 super function using 178–179 working on old style classes 173 superclasses multiples 154–155 specifying 153 Surface function pygame module 528 SWIG tool 361 compiling, linking, and using 364–365 detecting palindromes 362–363 extending Python 358 installing 362 interface file 363 introduction 361 running 363 using 362 synchronous network programming 298 SyntaxError class 161 sys module example 216 functions and variables 215 getdefaultencoding function 436 setdefaultencoding function 436 system function os module 217 ■T TCPServer class SocketServer module 303 telephone book example 70 revised 78 tell method file object 260 telnetlib module 302 Template class string Module 72 template strings 54 Test-Driven Development Beck, Kent et al 387

■INDEX<br />

599<br />

split function<br />

re module 239, 240<br />

Sprite class<br />

pygame.sprite module 530<br />

sqrt function 18<br />

math module 554<br />

Stackless <strong>Python</strong><br />

alternative <strong>Python</strong> distribution 6<br />

StandardError exception class 287<br />

start method<br />

adding <strong>to</strong> handler superclass 398<br />

Match Objects 242<br />

start_paragraph method<br />

adding <strong>to</strong> handler superclass 398<br />

statements 14–15<br />

assignment statements 83–85<br />

blocks 85–86<br />

conditional statements 86–87<br />

elif clauses 88<br />

else clauses 87<br />

if statements 87<br />

nesting blocks 88<br />

conditions 86<br />

assertions 93<br />

boolean statements 91–92<br />

comparison opera<strong>to</strong>rs 89–91<br />

del statements 103–104<br />

eval statements 105–106<br />

exec statements 104–105<br />

if statements 16<br />

import statements 82–83<br />

loops 93–94<br />

breaking out of 98–100<br />

for loops 95<br />

iterating over dictionaries 96<br />

iteration utilities 96–98<br />

while loops 94<br />

pass statements 102<br />

print statements 14, 16<br />

using with commas 81–82<br />

static methods<br />

creating with staticmethod objects 187<br />

stderr variable<br />

sys module 215, 258<br />

stdin variable<br />

itera<strong>to</strong>rability of 266<br />

sys module 215, 258<br />

stdout class<br />

sys module 215, 258<br />

write method 310<br />

S<strong>to</strong>pIteration exception 190<br />

str function 25, 561<br />

StreamRequestHandler class 303<br />

strftime function<br />

time module 227, 441<br />

string formatting<br />

dictionaries 71, 72<br />

string module 501<br />

Template class 72<br />

template strings 54<br />

values from 60<br />

string representations 25<br />

strings<br />

comparing strings and sequences 91<br />

concatenating strings 24<br />

input compared <strong>to</strong> raw_input 26<br />

long strings 27<br />

methods 563–565<br />

raw strings 27, 28<br />

single-quoted strings and escaping quotes<br />

23–24<br />

string formatting 53–56<br />

conversion types 56–57<br />

signs, alignment, and zero-padding<br />

58–59<br />

simple conversion 56<br />

width and precision 57

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!