★ wanayoo — archive 1999 http://fsbassociates.com/books/python.htmNouvelle recherche | Portail wanayoo

 

Internet Programming with Python

by Aaron Watters, Guido van Rossum, and James C. Ahlstrom

CD-ROM incl.; 478 pages; August 1996
M&T Books; $34.95 U.S.; 1-55851-484-8

Table of Contents      Online Chapter

This is the first comprehensive guide to demonstrate this dynamic object-oriented language. Python is one of the most portable, convenient, and powerful programming languages available today. It's also freely distributed as source code that can be modified and redistributed

Aaron Watters holds a PhD in Computer Science from the University of Pennsylvania and works for AT&T Laboratories on exploratory Internet applications.
Guido van Rossum is the primary author of the Python language. He was also a primary developer of the Amoeba operating system.
James C. Ahlstrom was the original author of the WPY/Python GUI package. He holds a PhD in Physics from Cornell University.

Table of Contents

Chapter 1
Introduction
1
Python gets the Job Done 2
What Python doesn't do well (by itself) 6
Python and the Internet 9
Background 11
Fasten your seatbelt, and have fun 12
Chapter 2
Bird's eye Python
13
This chapter introduces some of the primary syntactic and semantic features of the Python Language.
A Python Program 13
Execution Modes 16
Embedded Python 19
Indentation Block Structure 19
A Fearless Tour of Python Types 23
Chapter 3
Playing
41
This chapter introduces the basic components of a Python program using interactive ``play'' with the interpreter. Much of the chapter discusses character string manipulation in detail, because this provides a very accessible platform for illustrating the language, and because strings are important especially in network programming.
Playing with Strings 41
Playing with Lists 70
Playing with Dictionaries 77
An Abstract Data Type: Priority Queues 86
Chapter 4
Intrinsic Operations
95
This chapter summarizes most of the features of the Python language in a single place by discussing the intrinsic operations of basic object types.
Generic Intrinsic Operations 97
Intrinsic Operations for Dictionaries 103
Intrinsic Operations for Numeric Types 106
Intrinsic Operations for Sequences 111
Special Intrinsic Operations for Strings 120
Special Intrinsic Operations for Lists 125
Intrinsic Operations for Files 133
Intrinsic Operations for Callable Objects 137
Intrinsic Operations for Objects with Attributes 141
Simple Minded Multiple Inheritance Example 144
Instance Methods and the Automatic Binding of self 146
Intrinsic Operations for Modules 148
Intrinsic Operations for Executing Data 150
What Next?
Chapter 5
Syntax and Control
151
This chapter covers detailed issues of the syntax and semantics of Python control constructs.
Expressions 151
Literals 157
Operator Precedence 161
Variables and Scoping 162
Declarations 170
Assignments 174
The if Statement 175
Loops 175
Function and Method Definition 180
Class Definition 185
Exceptions 187
Miscellaneous 195
Chapter 6
More Goodies
197
A number of issues relating to Python Programming that don't fall into other categories are explained here.
Symbolic Constants 197
the if __name__="__main__" convention 198
How to load a module twice and why you shouldn't 199
The "Pound Bang Hack" 200
Input and Output 201
Byte Compilation 201
The Module Search Path 202
Memory Management 202
Local Scopes Don't Nest 203
Recursion 205
Class Instance Magic 207
Documentation Strings 211

Chapter 7
Generating HTML: A case study in dynamic objects

213
This chapter makes use of Python's advanced object model to develop tools for automatically formatting complex HTML constructs.
What HTML looks like 214
How HTML Works 217
A False Start: Generating Tables the Wrong Way 221
The Right Way to Generate HTML 235
Summary 280
Chapter 8
CGI Programming
281
This chapter describes the CGI mechanism used with the HTTP protocol to allow clients to submit data to a Web site and recieve responses from Web servers.
How CGI Works 282
Following a CGI Request 285
The CGI Life Cycle 292
GET Requests with Query Strings 293
Using the cgi Module 301
URL Encoded Post Requests 306
Handling Buggy or Malicious POSTs 309
Multipart Form Data POST Requests 313
Doing a Professional Job 315
A Superclass for cgi Programs 317
FORM Input Elements 321
File Upload 327
Generating FORMs 328
Summary 329
Chapter 9
Protocols
331
This chapter discusses the use of sockets and other tools to develop and implement network protocols.
A finger Client 333
A finger Server 337
CGI/HTTP Robot Clients 340
A Polling Robot Event Loop 344
Custom HTTP Servers 348
The Standards 350
A Guide to the Tools 351
Summary 353
Chapter 10
GUI Programming with Python
355
This chapter introduces the basic concepts for using Python as a graphical user interface programming language, with detailed examples.
A Crash Course on GUI Objects 357
GUI Hello World in Tkinter and WPY 361
An HTML Viewer 364
HTML Viewer Design 366
HTML Viewer GUI Classes 367
HTML Viewer Parser Classes 372
Summary 380
Chapter 11
Extending Python
381
This chapter describes how to add new compiled components to the Python interpreter, either statically or via dynamically loaded libraries.
On Reading the Python Source 382
Motivation for this extension 383
User's view of the extension module 384
General Form of an extension module 388
Compiling and Linking the Module 390
Detailed Implementation 396
Implementing Built in Functions 396
Managing Reference Counts 400
PyArg_ParseTuple 403
Debugging Tricks 405
Python Exceptions in C 406
Implementing a new type 407
A Brief Tour of the Python header files 423
Chapter 12
Embedding Python
425
This chapter describes how Python can be integrated as a component of another program, including a detailed discussion of embedding Python under a Netscape Server program using the NSAPI interface.
Why embed Python under the NSAPI? 426
Why embed Python under other software? 427
A General Strategy 427
the NSAPI embedding outline 429
Initialization 430
Configuration 434
What the Server Calls 435
What nsapimodule.c calls 435
What Python calls back 437
Compiling and Linking 441
Summary and Example 443
Appendix 1
Python versus similar languages
447
Appendix 2
Guide to standard Libraries
451
Appendix 3
Regular Expressions
455
Appendix 4
How to get Python
467
Index 469