Beginning Python - From Novice to Professional

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

16.01.2014 Views

■INDEX 577 assertEqual method TestCase class 348 AssertionError class 566 assertNotAlmostEqual method TestCase class 348 assertNotEqual method TestCase class 348 assertRaises method TestCase class 348 assignment statements 13, 83, 566 = operator 547 augmented assignment statements 84, 85, 566 chained assignments 84 changing lists 41 sequence unpacking 83–84 slice assignments 42 asterisk width specifier 58 async_chat class asynchat module 460 collect_incoming_data method 460–461 found_terminator method 460–461 handle_close method 461 push method 461 set_terminator method 460–461 asynchat module 302, 455–456 async_chat class 460 multiple connections 304 asynchronous I/O multiple connections 304 select and poll functions 306 asyncore framework 456 asyncore module 302, 455–456 dispatcher class 457 loop method 458 multiple connections 304 AttributeError class 161, 170 attributes, binding to functions 149 augmented assignments 84–85, 566 ■B backticks (` `) 551 converting a Python value to a string 25–26 BaseRequestHandler class 303 bdist command 377 Beautiful Soup module 319–320 Beck, Kent et al Refactoring 387 Test-Driven Development 387 binary mode mode argument, open function 257 bind method dispatcher class 458 socket class 298 blit method pygame.display module 529 transfering contents of one surface to another 529 blocking 298 blocks, indentation 85–86, 547 blocks generator instant markup project 394 body method NNTP class 441, 442 bool function 559 Boole, George 86 Boolean statements 91–92 Boolean values 86 break statements, 98, 568 else clauses 167 build command 374 built-in functions 16–17, 559 built-in methods issubclass method 153 bulletin board project 483 first implementation 486–489 further exploration 498 goals 483–484 preparations 484–485

578 ■INDEX problem 483 second implementation 489–490 edit.cgi 493–494 main.cgi 490, 492 save.cgi 494 testing 496 view.cgi 492–493 tools 484 ■C callable function 559 callback method adding to handler superclass 398 callproc() method cursor objects 289 Canvas class line method 413 pdfgen module 413 catching exceptions 162 CGI (Common Gateway Interface) CGI security risks 323 debugging with cgitb 324 dynamic web pages 321 adding the Pound Bang line 321–322 preparing the Web server 321 setting file permissions 322 invoking CGI scripts without forms 326 remote editing with CGI 473–481 simple CGI script 323–324 simple form 327–328 using cgi module 325–326 cgi module 302, 321, 330, 474 using 325–326 cgitb module 330 debugging with 324, 474 enable function 324 tracebacks 486 chained assignments 84 chained comparison operators 89 character sets 237 ChatRoom class commands implemented 466 ChatServer class 457–459 ChatSession class 459–463 enter method 466 checkIndex function 182 choice() function random module 228 chr function 559 class keyword defining classes 550 class methods creating with staticmethod and classmethod types 187 classes and types 147–148 attributes, functions and methods 149 creating 148 defining classes 550 definitions 570 interfaces 155–156 methods 150–151 multiple superclasses 154–155 namespaces 151–152 subclassing built-in classes 173 superclasses 153 clear method dictionaries 72–73 close function fileinput module 219 close method connection object 288, 486 cursor objects 289 file object 261 Shelve class 231 cmath module 18 Cmd class cmd module 509 command interpretation, modeling 463–464

578 ■INDEX<br />

problem 483<br />

second implementation 489–490<br />

edit.cgi 493–494<br />

main.cgi 490, 492<br />

save.cgi 494<br />

testing 496<br />

view.cgi 492–493<br />

<strong>to</strong>ols 484<br />

■C<br />

callable function 559<br />

callback method<br />

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

callproc() method<br />

cursor objects 289<br />

Canvas class<br />

line method 413<br />

pdfgen module 413<br />

catching exceptions 162<br />

CGI (Common Gateway Interface)<br />

CGI security risks 323<br />

debugging with cgitb 324<br />

dynamic web pages 321<br />

adding the Pound Bang line 321–322<br />

preparing the Web server 321<br />

setting file permissions 322<br />

invoking CGI scripts without forms 326<br />

remote editing with CGI 473–481<br />

simple CGI script 323–324<br />

simple form 327–328<br />

using cgi module 325–326<br />

cgi module 302, 321, 330, 474<br />

using 325–326<br />

cgitb module 330<br />

debugging with 324, 474<br />

enable function 324<br />

tracebacks 486<br />

chained assignments 84<br />

chained comparison opera<strong>to</strong>rs 89<br />

character sets 237<br />

ChatRoom class<br />

commands implemented 466<br />

ChatServer class 457–459<br />

ChatSession class 459–463<br />

enter method 466<br />

checkIndex function 182<br />

choice() function<br />

random module 228<br />

chr function 559<br />

class keyword<br />

defining classes 550<br />

class methods<br />

creating with staticmethod and<br />

classmethod types 187<br />

classes<br />

and types 147–148<br />

attributes, functions and methods 149<br />

creating 148<br />

defining classes 550<br />

definitions 570<br />

interfaces 155–156<br />

methods 150–151<br />

multiple superclasses 154–155<br />

namespaces 151–152<br />

subclassing built-in classes 173<br />

superclasses 153<br />

clear method<br />

dictionaries 72–73<br />

close function<br />

fileinput module 219<br />

close method<br />

connection object 288, 486<br />

cursor objects 289<br />

file object 261<br />

Shelve class 231<br />

cmath module 18<br />

Cmd class<br />

cmd module 509<br />

command interpretation, modeling<br />

463–464

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

Saved successfully!

Ooh no, something went wrong!