Python How to Program
Harvey M. Deitel, Deitel & Associates, Inc.
Paul J. Deitel, Deitel & Associates, Inc.
Jonathan P. Liperi
Ben Wiedermann, Deitel & Associates, Inc.

ISBN-10: 0130923613
ISBN-13: 9780130923615

Publisher: Prentice Hall
Copyright: 2002
Format: Paper; 1376 pp
Published: 02/04/2002

Suggested retail price: $118.00
Buy from myPearsonStore



For Python programming courses or Web programming courses focusing on Python programming found in departments of Computer Science, CIS, MIS, IT, Business, Engineering and Continuing Education.

An exciting addition to the How to Program series, Python How to Program provides a comprehensive introduction to this powerful object-oriented programming language, which has clear syntax and the ability to bring together several technologies quickly and easily. Python How to Program covers introductory programming techniques as well as more advanced topics such as graphical user interfaces, databases, wireless Internet programming, networking and multimedia. Students will learn principles that are applicable to both systems development and Web programming.

  • Signature “Live-Code™ Approach”—Language features are presented in the context of a wide variety of complete working programs. Features thousands of lines of code in hundreds of complete working programs.
    • Enables students to confirm that programs run as expected. Students can also manipulate the code from the book's Companion Website (www.prenhall.com/deitel) and the authors' website (www.deitel.com).

  • Outstanding, consistent and applied pedagogy—Icons throughout identify Software Engineering Observations; Good Programming Practices; Common Programming Errors; Portability Tips; Performance Tips, Testing and Debugging Tips, and Look-and-Feel Observations.
    • Provides hundreds of valuable programming tips and facilitates learning.

  • Extensive set of interesting exercises and substantial projects.
    • Students can apply what they've learned in each chapter.

  • Extensive case studies.
    • Illustrates the more complex real-world examples.

  • Four-way syntax coloring with the use of two colors and shading.
    • Helps students better understand the book's hundreds of programs.

  • Website
    • Includes source code, hyperlinks to valuable Python demos and resources, and additional Python development tools, visit www.prenhall.com or www.deitel.com.

  • Full chapter on Web accessibility for people with disabilities.
    • Discusses the methods that the World Wide Web Consortium provides in its Web Accessibility Initiative for making a Web site accessible to people with disabilities.

  • Also available with the Multimedia Cyber Classroom in The Complete Python Training Course, Student Edition ; Web-based version: 0-13-067381-1).
    • Provides extra hands-on experience and study aids for a minimal additional cost. Includes many hours of detailed, expert audio walkthroughs of the book's hundreds of live-code examples; post-assessment exams with hundreds of short-answer questions (all with answers), hundreds of self-review exercises drawn from the text all with answers), hundreds of programming exercises from the main text (these exercises don't have answers in the main text, but half of these exercises have answers in the Complete Training Course); hundreds of tips that are marked with icons and show how to write Python code that's portable, reusable, and optimized for performance; and full-text searching and hyperlinking.

Each How to Program text can be ordered as a Complete Training Course package, containing the main text and the corresponding Cyber Classroom—an interactive, multimedia, tutorial version of the book. The Complete Training Courses are a great value, giving students extra hands-on experience and study aids for a minimal additional cost.

Each Complete Training Course is compatible with Windows 95, Windows 98, Windows NT and Windows 2000 and includes the following features:

  • The full text, illustrations and program listings of its corresponding How to Program book with full-text searching and hyperlinking.
  • Hours of detailed, expert audio descriptions of thousands of lines of code that help to reinforce concepts.
  • An abundance of self-assessment material:
    • Practice exams that offer students hundreds of short-answer test questions and answers.

    • Hundreds of self-review questions that are drawn from the text, all with answers.

    • Hundreds of programming exercises that are drawn from the text, half with answers (the main text does not provide any answers to these exercises).

  • Intuitive browser-based interface, designed to be easy and accessible for anyone who's ever used a Web browser.

We offer the Complete Training Courses in a Web-based format. When professors order the Web-based version of a Complete Training Course, their students receive the corresponding How to Program book packaged with a URL and password that gives them six months of access to the Cyber Classroom software via the Web.

 

(NOTE: Each chapter begins with an Introduction.)

1. Introduction to Computers, Internet and World Wide Web.

What Is a Computer? Computer Organization. Evolution of Operating Systems. Personal Computing, Distributed Computing and Client/Server Computing. Machine Languages, Assembly Languages and High-Level Languages. Structured Programming. Object-Oriented Programming. Hardware Trends. History of the Internet and World Wide Web. World Wide Web Consortium (W3C). Extensible Markup Language (XML). Open-Source Software Revolution. History of Python. Python Modules. General Notes about Python and This Book. Tour of the Book. Internet and World Wide Web Resources.



2. Introduction to Python Programming.

First Program in Python: Printing a Line of Text. Modifying our First Python Program. Another Python Program: Adding Integers. Memory Concepts. Arithmetic. String Formatting. Decision Making: Equality and Relational Operators. Indentation. Thinking About Objects: Introduction to Object Technology.



3. Control Structures.

Algorithms. Pseudocode. Control Structures. if Selection Structure. if/else and if/elif/else Selection Structures. while Repetition Structure. Formulating Algorithms: Case Study 1: (Counter-Controlled Repetition). Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 2: (Sentinel-Controlled Repetition). Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 3: (Nested Control Structures). Augmented Assignment Symbols. Essentials of Counter-Controlled Repetition. for Repetition Structure. Using the for Repetition Structure. break and continue Statements. Logical Operators. Structured-Programming Summary.



4. Functions.

Program Components in Python. Functions. Module math Functions. Function Definitions. Random-Number Generation. Example: A Game of Chance. Scope Rules. Keyword import and Namespaces. Recursion. Example Using Recursion: The Fibonacci Series. Recursion vs Iteration. Default Arguments. Keyword Arguments.



5. Lists, Tuples and Dictionaries.

Sequences. Creating Sequences. Using Lists and Tuples. Dictionaries. List and Dictionary Methods. References and Reference Parameters. Passing Lists to Functions. Sorting and Searching Lists. Multiple-Subscripted Sequences.



6. Introduction to the Common Gateway Interface (CGI).

Client and Web Server Interaction. Simple CGI Script. Sending Input to a CGI Script. Using XHTML Forms to Send Input and Using Module cgi to Retrieve Form Data. Using cgi FieldStorage to Read Input. Other HTTP Headers. Example: Interactive Portal. Internet and World Wide Web Resources.



7. Object-Based Programming.

Implementing a Time Abstract Data Type with a Class. Special Attributes. Controlling Access to Attributes. Using Default Arguments with Constructors. Destructors. Class Attributes. Composition: Object References as Members of Classes. Data Abstraction and Information Hiding. Software Reusability.



8. Customizing Classes.

Customizing String Representation: Method__str__ Customizing Attribute Access. Operator Overloading. Restrictions on Operator Overloading. Overloading Unary Operators. Overloading Binary Operators. Overloading Built-in Functions. Converting Between Types. Case Study: A Rational Class. Overloading Sequence Operations. Case Study: A SingleList Class. Overloading Mapping Operations. Case Study: A SimpleDictionary Class.



9. Object-Oriented Programming: Inheritance.

Inheritance: Base Classes and Derived Classes. Creating Base Classes and Derived Classes. Overriding Base-Class Methods in a Derived Class. Software Engineering with Inheritance. Composition vs Inheritance. “Uses A” and “Knows A” Relationships. Case Study: Point, Circle, Cylinder. Abstract Base Classes and Concrete Classes. Case Study: Inheriting Interface and Implementation. Polymorphism. Classes and Python 2.2.



10. Graphical User Interface Components: Part 1.

Tkinter Overview ~. Simple Tkinter Example: Label Component. Event Handling Model. Entry Component. Button Component. Checkbutton and Radiobutton Components. Mouse Event Handling. Keyboard Event Handling. Layout Managers. Card Shuffling and Dealing Simulation. Internet and World Wide Web Resources.



11. Graphical User Interface Components: Part 2.

Overview of Pmw. ScrolledListbox Component. ScrolledText Component. MenuBar Component. Popup Menus. Canvas Component. Scale Component. Other GUI Toolkits.



12. Exception Handling.

Raising an Exception. Exception-Handling Overview. Example: DivideByZeroError. Python Exception Hierarchy. finally Clause. Exception Objects and Tracebacks. Programmer-Defined Exception Classes.



13. String Manipulation and Regular Expressions.

Fundamentals of Characters and Strings. String Presentation. Searching Strings. Joining and Splitting Strings. Regular Expressions. Compiling Regular Expressions and Manipulating Regular-Expression Objects. Regular-Expression Repetition and Placement Characters. Classes and Special Sequences. Regular Expression String-Manipulation Functions. Grouping. Internet and World Wide Web Resources.



14. File Processing and Serialization.

Data Hierarchy. Files and Streams. Creating a Sequential-Access File. Reading Data from a Sequential-Access File. Updating Sequential-Access Files. Random-Access Files. Simulating a Random-Access File: The shelve Module. Writing Data to a shelve File. Retrieving Data from a shelve File. Example: A Transaction-Processing Program. Object Serialization.



15. Extensible Markup Language (XML).

XML Documents. XML Namespaces. Document Object Model (DOM). Simple API for XML (SAX). Document Type Definitions (DTDs), Schemas and Validation. XML Vocabularies. Extensible Stylesheet Language (XSL). Internet and World Wide Web Resources.



16. Python XML Processing.

Generating XML Content Dynamically. XML Processing Packages. Document Object Model (DOM). Parsing XML with xml.sax. Case Study: Message Forums with Python and XML. Internet and World Wide Web Resources.



17. Database Application Programming Interface(DB-API).

Relational Database Model. Relational Database Overview: Books Database. Structured Query Language (SQL). Python DB-API Specification. Database Query Example. Querying the Books Database. Reading, Inserting and Updating a Database. Internet and World Wide Web Resources.



18. Process Management.

os.fork Function. os.system Function and os.exec Family of Functions. Controlling Process Input and Output. Interprocess Communication. Signal Handling. Sending Signals.



19. Multithreading.

Thread States: Life Cycle of a Thread. threading. ThreadExample. Thread Synchronization. Producer/Consumer Relationship without Thread Synchronization. Producer/Consumer Relationship with Thread Synchronization. Producer/Consumer Relationship: Module Queue. Producer/Consumer Relationship: The Circular Buffer. Semaphores. Events.



20. Networking.

Accessing URLs over HTTP. Establishing a Simple Server (Using Stream Sockets). Establishing a Simple Client (Using Stream Sockets). Client/Server Interaction with Stream Socket Connections. Connectionless Client/Server Interaction with Datagrams. Client/Server Tic-Tac-Toe Using a Multithreaded Server.



21. Security.

Ancient Ciphers to Modern Cryptosystems. Secret-Key Cryptography. Public-Key Cryptography. Cryptanalysis. Key-Agreement Protocols. Key Management. Digital Signatures. Public-Key Infrastructure, Certificates and Certificate Authorities. Security Protocols. Authentication. Security Attacks. Running Restricted Python Code. Network Security. Steganography. Internet and World Wide Web Resources.



22. Data Structures.

Self-Referential Classes. Linked Lists. Stacks. Queues. Trees.



23. Case Study: Online Bookstore.

HTTP Sessions and Session-Tracking Technologies. Tracking Sessions in the Bookstore. Bookstore Architecture. Configuring the Bookstore. Entering the Bookstore. Obtaining the Book List from the Database. Viewing a Book's Details. Adding an Item to the Shopping Cart. Viewing the Shopping Cart. Checking Out. Processing the Order. Error Handling. Handling Wireless Clients (XHTML Basic and WML). Internet and World Wide Web Resources.



24. Multimedia.

Introduction to PyOpenGL. PyOpenGL Examples. Introduction to Alice. Fox, Chicken and Seed Problem. Introduction to pygame. Python CD Player. Python Movie Player. Pygame Space Cruiser. Internet and World Wide Web Resources.



25. Python Server Pages (PSP).

Python Servlets. Python Server Pages Overview. First Python Server Page Example. Implicit Objects. Scripting. Standard Actions. Directives. Case Study: Message Forums with Python and XML. Internet and World Wide Web Resources.



Appendix A. Operator Precedence Chart.


Appendix B. ASCII Character Set.


Appendix C. Number Systems.

Introduction. Abbreviating Binary Numbers as Octal Numbers and Hexadecimal Numbers. Converting Octal Numbers and Hexadecimal Numbers to Binary Numbers. Converting from Binary, Octal or Hexadecimal to Decimal. Converting from Decimal to Binary, Octal or Hexadecimal. Negative Binary Numbers: Two's Complement Notation.



Appendix D. Python Development Environments.

Introduction. Integrated Development Environment: IDLE. Other Integrated Development Environments. Internet and World Wide Web Resources.



Appendix E. Career Opportunities.

Introduction. Resources for the Job Seeker. Online Opportunities for Employers. Recruiting Services. Career Sites. Internet and World Wide Web Resources.



Appendix F. Unicode®.

Introduction. Unicode. Characters and Glyphs. Advantages and Disadvantages of Unicode. Unicode Consortium's Web Site. Using Unicode. Character Ranges.



Appendix G. Introduction to HyperText Markup Language 4: Part 1.

Introduction. Markup Languages. Editing HTML. Common Elements. Headers. Linking. Images. Special Characters and More Line Breaks. Unordered Lists. Nested and Ordered Lists. Internet and World Wide Web Resources.



Appendix H. Introduction to HyperText Markup Language 4: Part 2.

Introduction. Basic HTML Tables. Intermediate HTML Tables and Formatting. Basic HTML Forms. More Complex HTML Forms. Internal Linking. Creating and Using Image Maps. meta Elements. frameset Element. Nested framesets. Internet and World Wide Web Resources.



Appendix I. Introduction to XHTML: Part 1.

Introduction. Editing XHTML. First XHTML Example. W3C XHTML Validation Service. Headers. Linking. Images. Special Characters and More Line Breaks. Unordered Lists. Nested and Ordered Lists. Internet and World Wide Web Resources.



Appendix J. Introduction to XHTML: Part 2.

Introduction. Basic XHTML Tables. Intermediate XHTML Tables and Formatting. Basic XHTML Forms. More Complex XHTML Forms. Internal Linking. Creating and Using Image Maps. meta Elements. framese Element. Nested framesets. Internet and World Wide Web Resources.



Appendix K. Cascading Style Sheets™ (CSS).

Introduction. Inline Styles. Embedded Style Sheets. Conflicting Styles. Linking External Style Sheets. W3C CSS Validation Service. Positioning Elements. Backgrounds. Element Dimensions. Text Flow and the Box Model. User Style Sheets. Internet and World Wide Web Resources.



Appendix L. Accessibility.

Introduction. Web Accessibility. Web Accessibility Initiative. Providing Alternatives for Images. Maximizing Readability by Focusing on Structure. Accessibility in XHTML Tables. Accessibility in XHTML Frames. Accessibility in XML. Using Voice Synthesis and Recognition with VoiceXML™. Cal1XML™. JAWS® for Windows. Other Accessibility Tools. Accessibility in Microsoft® Windows® 2000. Internet and World Wide Web Resources.



Appendix M. HTML/XHTML Special Characters.


Appendix N. HTML/XHTML Colors.


Appendix O. Additional Python 2.2 Features.

Introduction. Iterators. Generators. Nested Scopes. Internet and World Wide Web Resources.



Bibliography.


Index.

Dr. Harvey M. Deitel, CEO and Chairman of Deitel & Associates, Inc., has 41 years experience in the computing field, including extensive industry and academic experience. Dr. Deitel earned B.S. and M.S. degrees from the Massachusetts Institute of Technology and a Ph.D. from Boston University. He worked on the pioneering virtual-memory operating-systems projects at IBM and MIT that developed techniques now widely implemented in systems such as UNIX, Linux and Windows NT. He has 20 years of college teaching experience, including earning tenure and serving as the Chairman of the Computer Science Department at Boston College before founding Deitel & Associates, Inc., with his son, Paul J. Deitel. He is the author or co-author with Paul Deitel of several dozen books and multimedia packages and is writing many more. With translations published in Japanese, Russian, Spanish, Traditional Chinese, Simplified Chinese, Korean, French, Polish, Italian and Portuguese, Dr. Deitel's texts have earned international recognition. Dr. Deitel has delivered hundreds of professional seminars to major corporations, government organizations and various branches of the military.

Paul J. Deitel, Executive Vice President and Chief Technical Officer of Deitel & Associates, Inc., is a graduate of the Massachusetts Institute of Technology's Sloan School of Management, where he studied Information Technology. Through Deitel & Associates, Inc., he has delivered Java, C, C++ and Internet and World Wide Web courses to industry clients including Compaq, Sun Microsystems, White Sands Missile Range, Rogue Wave Software, Boeing, Dell, Stratus, Fidelity, Cambridge Technology Partners, Open Environment Corporation, One Wave, Hyperion Software, Lucent Technologies, Adra Systems, Entergy, CableData Systems, NASA at the Kennedy Space Center, the National Severe Storm Laboratory, IBM and many other organizations. He has lectured on C++ and Java for the Boston Chapter of the Association for Computing Machinery and has taught satellite-based Java courses through a cooperative venture of Deitel & Associates, Inc., Prentice Hall and the Technology Education Network. He and his father, Dr. Harvey M. Deitel, are the world's best-selling Computer Science textbook authors.

Jonathan Liperi is a senior at Boston University where he has been accepted into the Computer Science department's BA/MA program. He will earn his Master's degree in Computer Science in May 2003. His coursework has included advanced algorithms, queueing theory, computer architecture, computer networks, artificial intelligence, computer graphics, database systems, software engineering and various programming courses (C, C++, Python and Java).

Ben Wiedermann graduated from Boston University magna cum laude with a degree in Computer Science and a minor in Theater Arts. Ben plans to pursue post-graduate work in programming-language theory. Other Deitel publications to which he has contributed include Java How to Program, Fourth Edition; C++ How to Program, Third Edition; Perl How to Program; Internet and World Wide Web How to Program, Second Edition; XML How to Program; e-Business & e-Commerce How to Program and C How to Program, Third Edition.

The authoritative DEITEL LIVE-CODE introduction to Python programming

This new book by the world's leading programming language textbook authors carefully explains how to use Python as a general-purpose programming language and how to program multi-tier, client/server, database-intensive, Internet- and Web-based applications.

Dr. Harvey M. Deitel and Paul J. Deitel are the founders of Deitel & Associates, Inc., the internationally-recognized corporate-training and content-creation organization specializing in Python, Visual Basic® .NET, C#, Visual C++® .NET, Java, C++, C, XML, Perl, Internet, Web, wireless and object technologies. The Deitels are the authors of several worldwide #1 programming-language textbooks, including Java How to Program, 4/e, C++ How to Program, 3/e and Internet & World Wide Web How to Program, 2/e.

In Python How to Program, the Deitels and their colleagues, Jonathan Liperi and Ben Wiedermann, discuss topics you need to build complete Web-based applications, including:

  • HTML/XHTML/CSS
  • Python Server Pages/CGI
  • Networking/Sockets
  • GUI/Tkinter/Python Mega Widgets
  • PyOpenGL/Multimedia/Accessibility
  • Databases/DB-API/SQL
  • File Processing/Serialization
  • Modules/Classes/Class Attributes
  • Class Customization/Method Overriding
  • Control Structures/Functions/Inheritance
  • String Manipulation/Regular Expressions
  • Lists/Tuples/Dictionaries/Data Structures
  • Process Management/Multithreading
  • Interprocess Communication
  • Exceptions/XML Processing
  • Security/Restricted Execution

Python How to Program includes extensive pedagogic features:

  • Hundreds of LIVE-CODE programs with screen captures that show exact outputs
  • World Wide Web and Internet resources to encourage further research
  • Hundreds of tips, recommended practices and cautions—all marked with icons

Python How to Program is the centerpiece of a complete family of resources for teaching and learning Python, including Web sites (www.deitel.com, www.prenhall.com/deitel and www.InformIT.com/deitel) with the book's source-code examples and other information for faculty, students and professionals;(Python Multimedia Cyber Classroom) containing hyperlinks, solutions to half the book's exercises and audio walkthroughs of the book's code examples; and e-mail access to the authors at deitel@deitel

For information on worldwide Deitel on-site seminars and to subscribe to the Deitel Buzz e-mail newsletter, visit: www.deitel.com

For information on current and forthcoming Deitel/Prentice Hall publications including How to Program Series books, Multimedia Cyber Classrooms Complete Training Courses (which include DEITEL books and Cyber Classrooms) and Web-Based Training Courses please see the last few pages of this book.

View a Sample Chapter PDF:

  • Companion Website - Deitel
    Deitel
    © 2002 | Prentice Hall | On-line Supplement | Instock
    ISBN-10: 0130601039 | ISBN-13: 9780130601032
    URL: http://www.prenhall.com/deitel


  • Instructor Resource Center
    Deitel
    © 2002 | Prentice Hall | On-line Supplement | Estimated Availability: 01/15/2002
    ISBN-10: 0136044484 | ISBN-13: 9780136044482
    View Downloadable Files

Pearson Higher Education offers special pricing when you choose to package your text with other student resources. If you're interested in creating a cost-saving package for your students, contact your Pearson Higher Education representative for pricing and ordering information.

Pearson Higher Education offers special pricing when you choose to package your text with other student resources. If you're interested in creating a cost-saving package for your students contact your Pearson Higher Education representative.


Copyright ©2008 Pearson Education. All rights reserved. Legal Notice | Privacy Policy | Permissions