Home > Store > Open Source > Python

larger cover

Add To My Wish List

Programming in Python 3: A Complete Introduction to the Python Language

Register your product to gain access to bonus material or receive a coupon.

  • Description
  • Downloads
  • Extras
  • Reviews
  • Sample Content

Product Author Bios

Mark Summerfield, owner of Qtrac Ltd., is an independent trainer, consultant, technical editor, and writer specializing in Python, C++, Qt, and PyQt. His books include Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming (Addison-Wesley, 2008) and, cowritten with Jasmin Blanchette, C++ GUI Programming with Qt 4 (Addison-Wesley, 2006). As Trolltech’s documentation manager, Mark founded and edited Trolltech’s technical journal, Qt Quarterly.

Python 3 is the best version of the language yet: It is more powerful, convenient, consistent, and expressive than ever before. Now, leading Python programmer Mark Summerfield demonstrates how to write code that takes full advantage of Python 3’s features and idioms. The first book written from a completely “Python 3” viewpoint, Programming in Python 3 brings together all the knowledge you need to write any program, use any standard or third-party Python 3 library, and create new library modules of your own.

 

Summerfield draws on his many years of Python experience to share deep insights into Python 3 development you won’t find anywhere else. He begins by illuminating Python’s “beautiful heart”: the eight key elements of Python you need to write robust, high-performance programs. Building on these core elements, he introduces new topics designed to strengthen your practical expertise–one concept and hands-on example at a time. This book’s coverage includes

 

  • Developing in Python using procedural, object-oriented, and functional programming paradigms
  • Creating custom packages and modules
  • Writing and reading binary, text, and XML files, including optional compression, random access, and text and XML parsing
  • Leveraging advanced data types, collections, control structures, and functions
  • Spreading program workloads across multiple processes and threads
  • Programming SQL databases and key-value DBM files
  • Utilizing Python’s regular expression mini-language and module
  • Building usable, efficient, GUI-based applications
  • Advanced programming techniques, including generators, function and class decorators, context managers, descriptors, abstract base classes, metaclasses, and more

 

Programming in Python 3serves as both tutorial and language reference, and it is accompanied by extensive downloadable example code–all of it tested with the final version of Python 3 on Windows, Linux, and Mac OS X.

Source Code

Visit the author's web site to access the source code.

Related Article

Python Descriptors

Customer Reviews

45 of 48 people found the following review helpful
5.0 out of 5 stars Excellent, January 6, 2009
By 
Kelly D. Painter (Lompoc, CA USA) - See all my reviews
(REAL NAME)   
Amazon Verified Purchase(What's this?)
This review is from: Programming in Python 3: A Complete Introduction to the Python Language (Paperback)
I am new to Python and wanted to learn. Prior to purchasing this book, I was reading "Learning Python" by Mark Lutz. I was literally half way through that book and couldn't write even a simple script due to the way that book is structured. I would not recommend that book. I was frustrated and ordered this book due to its coverage of Python 3. I am pleased.

This book takes an approach that gives the reader a quick overview of the language that is complete enough to start using Python by page 40! When the book mentions a topic that is covered elsewhere, there is a little box in the margin that tells the page that topic is covered - foward and backward. Great idea! That is very handy.

I had a little task that I wanted to write a script to do and I was able to do that easily after finishing the quick intro.

I am still reading the book and there is a lot of advanced information that I have not read yet. If the beginning of the book is any... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


25 of 28 people found the following review helpful
3.0 out of 5 stars Not for me.., April 2, 2009
By 
R Foose "philognosist" (Quincy, Illinois United States) - See all my reviews
Amazon Verified Purchase(What's this?)
This review is from: Programming in Python 3: A Complete Introduction to the Python Language (Paperback)
A previous reviewer mentioned his experience with Mark Lutz's book. I had a similar experience with Lutz's book too. Unfortunately, after what starts out with a very useful approach (one which should be widely used by other authors) of getting you up and running quickly, Summerfield's book falls into the same problems that Lutz's book had. Namely, it s very densely written, with no obvious separation in the text from what is the useful overall knowledge about a topic and what is the more arcane. I plodded through about the first third of the book, until I realized I was becoming confused about what I already knew about Python..so I quit. To be fair, the book is not intended as a tutorial so much as it is a reference. But I have to say, that it needs a major overhaul before it can be really useful in this context too. For example, more separation using white space, or sub heads, or something, should separate sections within a chapter, and separate examples and illustrations from... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


7 of 8 people found the following review helpful
5.0 out of 5 stars Fantastic Introduction for Experienced Programmers, May 30, 2009
Amazon Verified Purchase(What's this?)
This review is from: Programming in Python 3: A Complete Introduction to the Python Language (Paperback)
This book is clearly targeted at developers who are already experienced programmers in some other language, who wish to migrate their skills over to Python. The book goes through each of Python's language features piece by piece, in a no-nonsense, concise manner. The book is excellent at explaining how Python implements various programming paradigms and different approaches to the "Python way" of doing things. It doesn't "talk down" to you, or spend chapters and chapters going over basic demo programs. This allows the book to cover a lot of topics very thoroughly.

For me, the book was an excellent read and a great way to dive in to Python, and I expect other programmers would have the same experience. However, the pace is probably a bit too brisk for people who are programming for the very first time.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


Share your thoughts with other customers:
 See all 21 customer reviews...

Online Sample Chapters

Introduction to Python 3

Regular Expressions in Python

Regular Expressions in Python 3

Table of Contents

Introduction 1

 

Chapter 1: Rapid Introduction to Procedural Programming 7

Creating and Running Python Programs 7

Python’s “Beautiful Heart” 12

Examples 36

Summary 42

Exercises 44

 

Chapter 2:Data Types 47

Identifiers and Keywords 47

Integral Types 50

Floating-Point Types 54

Strings 61

Examples 88

Summary 95

Exercises 97

 

Chapter 3: Collection Data Types 99

Sequence Types 99

Set Types 112

Mapping Types 117

Iterating and Copying Collections 127

Examples 138

Summary 146

Exercises 147

 

Chapter 4: Control Structures and Functions 149

Control Structures 149

Exception Handling 153

Custom Functions 161

Example: make_html_skeleton.py 175

Summary 181

Exercise 182

 

Chapter 5: Modules 185

Modules and Packages 185

Overview of Python’s Standard Library 202

Summary 219

Exercise 220

 

Chapter 6: Object-Oriented Programming 223

The Object-Oriented Approach 224

Custom Classes 228

Custom Collection Classes 251

Summary 272

Exercises 274

 

Chapter 7: File Handling 277

Writing and Reading Binary Data 282

Writing and Parsing Text Files 294

Writing and Parsing XML Files 302

Random Access Binary Files 313

Summary 326

Exercises 327

 

Chapter 8: Advanced Programming Techniques 329

Further Procedural Programming 330

Further Object-Oriented Programming 353

Functional-Style Programming 384

Example: Valid.py 388

Summary 390

Exercises 392

 

Chapter 9: Processes and Threading 395

Delegating Work to Processes 396

Delegating Work to Threads 400

Summary 409

Exercises 410

 

Chapter 10: Networking 413

Creating a TCP Client 414

Creating a TCP Server 420

Summary 427

Exercises 427

 

Chapter 11: Database Programming 431

DBM Databases 432

SQL Databases 436

Summary 443

Exercise 444

 

Chapter 12: Regular Expressions 445

Python’s Regular Expression Language 446

The Regular Expression Module 455

Summary 464

Exercises 465

 

Chapter 13: Introduction to GUI Programming 467

Dialog-Style Programs 470

Main-Window-Style Programs 476

Summary 491

Exercises 491

 

Epilogue 493

Index 495

Sample Pages

Download the sample pages

 
Purchase Reward: One Month Free Subscription
By completing any purchase on InformIT, you become eligible for an unlimited access one-month subscription to Safari Books Online.

Get access to thousands of books and training videos about technology, professional development and digital media from more than 40 leading publishers, including Addison-Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media, Wrox, Apress, and many more. If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months. That's a total savings of $199.