Programming in Python 3 (Second Edition)

compare, pdf, diffpdf, diffpdfc, python

Programming in Python 3 (Second Edition)

A Complete Introduction to the Python Language

ISBN-10: 0321680561 – ISBN-13: 978-0321680563

A sample chapter is available free from InformIT—click “Sample Content” and then “Download the sample pages”.

This book teaches you how to write programs using Python 3, the most up to date, powerful and flexible version of Python yet released. Python 3 introduces many new idioms compared with Python 2 that make programming with it easier and at the same time helps produce clearer and more maintainable code. Python 3 is a superb very high level language, that is very easy to learn and use even by relatively inexperienced programmers. And once learned, Python 3 does not impose limits or restrictions, instead offering incredibly powerful and advanced facilities for those who want to learn and use them. Python runs on Windows and most Unix-like operating systems such as Mac OS X, BSD, and Linux.

The book will be useful to people who program professionally as part of their job, whether as full-time software developers, or those from other disciplines, including scientists and engineers, who need to do some programming in support of their work. It will also prove ideal for those Python 2 programmers who need to migrate (or prepare to migrate) to Python 3. The book is also suitable for students—the only prerequisite is some basic knowledge of programming in any language, for example, Basic, Java, or JavaScript, or of course Python itself.

The book focuses exclusively on Python 3 to avoid the risk of confusion with earlier versions. However, existing Python 2 programmers might find my highly condensed Moving from Python 2 to Python 3 document (4 pages, PDF, 676K) to be a helpful companion.

The book is 648 pages, and is published by Addison-Wesley Professional. Previews are available from Safari, and the Introduction, all of Chapter 13 (Regular Expressions), and the index is available from InformIT (click the Sample Content tab and then the Download the sample pages link).

The book can be bought from amazon and other online and local book stores.

Only the printed editions are definitive—although available in electronic formats, “ebooks” usually restrict your rights, and they are often retypeset which can introduce errors. A legal PDF version is available from InformIT. Translations are arranged by the publisher and their quality can vary considerably.

This second edition has been fully revised and updated to cover both Python 3.0 and Python 3.1 (and is useful for all Python 3.x versions), and extended with new chapters on debugging, testing, and profiling, and on parsing (with coverage of the third party PyParsing and PLY modules), as well as a new section on coroutines in the Advanced chapter. After mastering this book, read Python in Practice to progress further.

The source code is available in two formats, py3book30.tar.gz (293K suitable for any platform), and (403K Windows line endings) [updated 2013-07-26] —all the examples and code snippets have been tested with Python 3.0, 3.1, 3.2, 3.3, and 3.4. If you don’t care about Python 3.0-compatibility, then you might prefer the Python 3.1+ versions of the examples: py3book31.tar.gz (293K suitable for any platform), and (403K Windows line endings) [updated 2014-03-23] . There is also an Errata [updated 2015-06-11] .

Table of Contents—the chapters also have exercises and summaries

  • Introduction
  • Chapter 1. Rapid Introduction to Procedural Programming
    • Creating and Executing Python Programs
    • Python’s “Beautiful Heart”
  • Chapter 2. Data Types
    • Identifiers and Keywords
    • Integral Types
    • Floating-Point Types
    • Strings
  • Chapter 3. Collection Data Types
    • Sequence Types
    • Set Types
    • Mapping Types
    • Iterating and Copying Collections
  • Chapter 4. Control Structures and Functions
    • Control Structures
    • Exception Handling
    • Custom Functions
  • Chapter 5. Modules
    • Modules and Packages
    • Overview of Python’s Standard Library
  • Chapter 6. Object-Oriented Programming
    • The Object-Oriented Approach
    • Custom Classes
    • Custom Collection Classes
  • Chapter 7. File Handling
    • Writing and Reading Binary Data
    • Writing and Parsing Text Files
    • Writing and Parsing XML Files
    • Random Access Binary Files
  • Chapter 8. Advanced Programming Techniques (One example from this chapter inspired my Python Descriptors article.)
    • Further Procedural Programming
    • Further Object-Oriented Programming
    • Functional-Style Programming
  • Chapter 9. Debugging, Testing, and Profiling
    • Debugging
    • Unit Testing
    • Profiling
  • Chapter 10. Processes and Threading
    • Using the Multiprocessing Module
    • Using the Threading Module
  • Chapter 11. Networking
    • Creating a TCP Client
    • Creating a TCP Server
  • Chapter 12. Database Programming
    • DBM Databases
    • SQL Databases
  • Chapter 13. Regular Expressions (This chapter can be downloaded from InformIT—click the Sample Content tab and then the Download the sample pages link.)
    • Python’s Regular Expression Language
    • The Regular Expression Module
  • Chapter 14. Introduction to Parsing
    • BNF Syntax and Parsing Terminology
    • Writing Handcrafted Parsers
    • Pythonic Parsing with PyParsing
    • Lex/Yacc-Style Parsing with PLY
  • Chapter 15. Introduction to GUI Programming
    • Dialog-Style Programs
    • Main Window-Style Programs
  • Epilogue
  • Selected Bibliograpy
  • Index

Unsolicited Reader Comments

  • “I have read a good number of programming and technical books and your book is the best written programming/technical book I’ve ever read.”
  • “I really enjoy your books! Keep up the great work. The industry needs more authors like you.”
  • “I am currently reading your book `Programming in Python 3: A Complete Introduction to the Python Language, Second Edition’, which I find very interesting and motivating.”
  • “I’ve been learning Python 3 with `Programming in Python 3 (2nd ed.)’ for some time now. The book also makes for a good reference, with all those perfectly designed tables.”
  • “Enjoying the text, well done, well-edited (noticed no typos either).”

Reviews (for the First Edition)

  • Review by Robert Field (BayPIGgies)—”I recommend this book to any experienced programmer who needs to get up to speed on Python 3 and its use in modern programming environments.”
  • Review by Phil Brooke (University of Teesside) (the review begins about halfway down the page)
  • Review by James Pyles
  • A Podcast that is primarily devoted to a review of the book by Ron Stephens—”I recommend Programming in Python 3
  • A Podcast about Python that includes a brief review of the book by Ron Stephens
  • Python 3 article by Paul Barry (Linux Journal) (the book is mentioned at the end—”an excellent introduction to Python idioms and practices”)

For more information on Python 3 see the Python website.

Copyright © 2006 Qtrac Ltd. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.