Pro Python

by Marty Alchin

Thank you for your interest in Pro Python by Marty Alchin, a new book from Apress, to be released in 2010. It’s still early in the authoring process, but you can already pre-order now from Amazon.

What’s this one about?

There are already a number of Python books available, but they tend to fall into two categories: some for getting started and others focusing on specific topics. Those are essential topics, but those two categories alone make it sound like the only way to learn more than just the basics is to be involved in a very specific type of project. The reality is that Python offers a wide range of more advanced features that can be applied to any application.

Pro Python will cover many of the tools and techniques that Python makes available to your applications, so you can easily incorporate them into your code. From the principles and philosophy that guide Python development to the mystery of metaclasses and beyond, there’s something for everyone.

Well, not quite everyone. Much like my last book, Pro Django, I’m proud to say that Pro Python is not for beginners. There are plenty of other resources out there to help you get started with Python, so if that’s what you need, I’d suggest first reading Dive Into Python 3 by Mark Pilgrim. Once you know your way around Python, Pro Python will take you the rest of the way.

Now? Really?

If you’ve been using Python for very long, you’re probably already aware of the divide between Python 2 and Python 3. The Python community is beginning a long-term transition to a major shift in Python, with a number of incompatible changes between the two platforms. It’s a troubling time, but Pro Python looks to the future by covering the Python 3 line out of the box.

It’s too early to leave the past behind though, so Pro Python also includes compatibility notes on those features that were added, changed or removed in the past few releases of Python. You’ll be able to use the techniques presented in Python installations going back to version 2.5, with additional information about how those features are affected by more recent versions. You’ll learn how to:

  • change your code to support Python 3,
  • write code that’s compatible with as many versions of Python as possible, and
  • implement features yourself if they’re not yet available in your current version of Python.

Thankfully, Python has frozen the core language for a while, so the changes that take place after Pro Python shouldn’t be fundamental enough to cause any problems. You can look forward to using Pro Python for a long time to come.

How did it come to be?

While writing Pro Django back in 2008, it became clear that you can’t really understand a framework as complex as Django without first knowing about the Python features that make it possible. To my surprise, the chapter I wrote to cover those topics proved to be the most popular of the entire book. In fact, nearly every review of Pro Django called out its second chapter as the best in the entire book. To illustrate, I’ve included some of my readers’ feedback in the sidebar on this page.

With such fervent interest in coverage of general Python topics, I realized how great of an opportunity I had to finally expand on that chapter and cover everything I’d like to have included in Pro Django. Therefore, Pro Python showcases as much of Python’s advanced functionality as I can muster. It’s my hope that readers will come away with enough knowledge to turn their own applications into projects that might someday revolutionize the way people solve problems, just like Django did for the web.

Here are just a few of the things people are saying about chapter 2 of Pro Django, which is being expanded into the upcoming title, Pro Python:

The most awesome-est chapter I’ve read from a technical book. Ever. Seriously.

Rob Hudson

Chapter 2 of @Gulopine’s Pro Django should be sold as a cheap stand-alone .pdf. And _every_ python programmer should buy it.

Christian Metts

Chapter 2 is the best introduction to some of Python’s more advanced features I’ve read.

—Eivind Uggedal

Chapter 2 of this book is by far one of the greatest overviews of ‘advanced’ python I’ve ever read.

—James Turk

Chpt. 2 features the clearest and best explanation of metaprogramming in Python I’ve ever encountered.

—Daniel Lindsley

With one of the best descriptions that I have read of metaclassing in python, this chapter starts off guns a-blazing.

—Eric Holscher

It’s really a “Pro Python” chapter and covered very well.

Jeff Triplett