Monday, February 14, 2011

Python - Building Skills in Python

Python - Building Skills in Python

Table of Contents

Preface
Why Read This Book?
Audience
Organization of This Book
Limitations
Programming Style
Conventions Used in This Book
Acknowledgements
I. Language Basics
1. Background and History
History
Features of Python
Comparisons
2. Python Installation
Windows Installation
Macintosh Installation
GNU/Linux and UNIX Overview
YUM Installation
RPM Installation
"Build from Scratch" Installation
3. Getting Started
Command-Line Interaction
The IDLE Development Environment
Script Mode
Syntax Formalities
Exercises
Other Tools
Style Notes: Wise Choice of File Names
4. Simple Numeric Expressions and Output
The print Statement
Numeric Types and Operators
Numeric Conversion Functions
Built-In Functions
Expression Exercises
Expression Style Notes
5. Advanced Expressions
Using Modules
The math Module
The random Module
Advanced Expression Exercises
Bit Manipulation Operators
Division Operators
6. Variables, Assignment and Input
Variables
The Assignment Statement
Input Functions
Multiple Assignment Statement
The del Statement
Interactive Mode Revisited
Variable and Assignment Exercises
Variables and Assignment Style Notes
7. Truth, Comparison and Conditional Processing
Truth and Logic
Comparisons
Conditional Processing: the if Statement
The pass Statement
The assert Statement
The if-else Operator
Condition Exercises
Condition Style Notes
8. Looping
Iterative Processing: For All and There Exists
Iterative Processing: The for Statement
Iterative Processing: The while Statement
More Iteration Control: break and continue
Iteration Exercises
Condition and Loops Style Notes
A Digression
9. Functions
Semantics
Function Definition: The def and return Statements
Function Use
Function Varieties
Some Examples
Hacking Mode
More Features
Function Exercises
Object Method Functions
Functions Style Notes
10. Additional Notes On Functions
Functions and Namespaces
The global Statement
Call By Value and Call By Reference
Function Objects
II. Data Structures
11. Sequences: Strings, Tuples and Lists
Semantics
Overview of Sequences
Exercises
Style Notes
12. Strings
String Semantics
String Literal Values
String Operations
String Comparison Operations
String Built-in Functions
String Methods
String Modules
String Exercises
Digression on Immutability of Strings
13. Tuples
Tuple Semantics
Tuple Literal Values
Tuple Operations
Tuple Comparison Operations
Tuple Statements
Tuple Built-in Functions
Tuple Exercises
Digression on The Sigma Operator
14. Lists
List Semantics
List Literal Values
List Operations
List Comparison Operations
List Statements
List Built-in Functions
List Methods
List Exercises
15. Mappings and Dictionaries
Dictionary Semantics
Dictionary Literal Values
Dictionary Operations
Dictionary Comparison Operations
Dictionary Statements
Dictionary Built-in Functions
Dictionary Methods
Dictionary Exercises
Advanced Parameter Handling For Functions
16. Sets
Set Semantics
Set Literal Values
Set Operations
Set Comparison Operators
Set Statements
Set Built-in Functions
Set Methods
Set Exercises
17. Exceptions
Exception Semantics
Basic Exception Handling
Raising Exceptions
An Exceptional Example
Complete Exception Handling and The finally Clause
Exception Functions
Exception Attributes
Built-in Exceptions
Exception Exercises
Style Notes
A Digression
18. Generators and the yield Statement
Generator Semantics
Defining a Generator
Generator Functions
Generator Statements
Generator Methods
Generator Example
Generator Exercises
Subroutines and Coroutines
19. Files
File Semantics
Additional Background
Built-in Functions
File Methods
Several Examples
File Exercises
20. Advanced Sequences
Lists of Tuples
List Comprehensions
Sequence Processing Functions: map, filter, reduce and zip
Advanced List Sorting
Multi-Dimensional Arrays or Matrices
The Lambda
Exercises
III. Data + Processing = Objects
21. Classes
Semantics
Class Definition: the class Statement
Creating and Using Objects
Special Method Names
Some Examples
Object Collaboration
Class Definition Exercises
22. Advanced Class Definition
Inheritance
Polymorphism
Built-in Functions
Collaborating with max, min and sort
Initializer Techniques
Class Variables
Static Methods and Class Method
Design Approaches
Advanced Class Definition Exercises
Style Notes
23. Some Design Patterns
Factory Method
State
Strategy
Design Pattern Exercises
24. Creating or Extending Data Types
Semantics of Special Methods
Basic Special Methods
Special Attribute Names
Numeric Type Special Methods
Container Special Methods
Iterator Special Method Names
Attribute Handling Special Method Names
Extending Built-In Classes
Special Method Name Exercises
25. Properties and Descriptors
Semantics of Attributes
Descriptors
Properties
Attribute Access Exercises
26. Decorators
Semantics of Decorators
Built-in Decorators
Defining Decorators
Defining Complex Decorators
Decorator Exercises
27. Managing Contexts: the with Statement
Semantics of a Context
Using a Context
Defining a Context Manager Class
IV. Components, Modules and Packages
28. Modules
Module Semantics
Module Definition
Module Use: The import Statement
Finding Modules: The Path
Variations on An import Theme
The exec Statement
Module Exercises
Style Notes
29. Packages
Package Semantics
Package Definition
Package Use
Package Exercises
Style Notes
30. The Python Library
Overview of the Python Library
Most Useful Library Sections
Library Exercises
31. Complex Strings: the re Module
Semantics
Creating a Regular Expression
Using a Regular Expression
Regular Expression Exercises
32. Dates and Times: the time and datetime Modules
Semantics: What is Time?
Some Class Definitions
Creating a Date-Time
Date-Time Calculations and Manipulations
Presenting a Date-Time
Time Exercises
Additional time Module Features
33. File Handling Modules
The os.path Module
The os Module
The fileinput Module
The tempfile Module
The glob and fnmatch Modules
The shutil Module
The File Archive Modules: tarfile and zipfile
The Data Compression Modules: zlib, gzip, bz2
The sys Module
Additional File-Processing Modules
File Module Exercises
34. File Formats: CSV, Tab, XML, Logs and Others
Overview
Comma-Separated Values: The csv Module
Tab Files: Nothing Special
Property Files and Configuration (or.INI) Files: The ConfigParser Module
Fixed Format Files, A COBOL Legacy: The codecs Module
XML Files: The xml.minidom and xml.sax Modules
Log Files: The logging Module
File Format Exercises
35. Programs: Standing Alone
Kinds of Programs
Command-Line Programs: Servers and Batch Processing
The getopt Module
The optparse Module
Command-Line Examples
Other Command-Line Features
Command-Line Exercises
36. Programs: Clients, Servers, the Internet and the World Wide Web
About TCP/IP
Web Servers and the HTTP protocol
Web Services: The xmlrpclib Module
Mid-Level Protocols: The urllib2 Module
Client-Server Exercises
Socket Programming
V. Projects
37. Areas of the Flag
38. The Date of Easter
39. Musical Pitches
Equal Temperament
Overtones
Circle of Fifths
Pythagorean Tuning
Five-Tone Tuning
40. Bowling Scores
41. Mah Jongg Hands
Tile Class Hierarchy
Wall Class
Set Class Hierarchy
Hand Class
Some Test Cases
Hand Scoring - Points
Hand Scoring - Doubles
Limit Hands
42. Chess Game Notation
Algebraic Notation
Descriptive Notation
Game State
PGN Processing Specifications
Bibliography

List of Tables

23.1. Craps Game States

No comments:

Post a Comment