To help address a few frequently asked questions, this page contains the first part of the Preface from the book Learning Python. These sections describe the book's scope and style. This book is to be released in early April, 1999.
This book provides a quick introduction to the Python programming language. Python is a popular object-oriented language used for both standalone programs and scripting applications in a variety of domains. It's free, portable, powerful, and remarkably easy to use. Whether you're new to programming or a professional developer, this book's goal is to bring you up to speed on the core Python language in a hurry. Before we jump into details, we'd like to use this preface to say a few words about the book's design.
Although this text covers the essentials of the Python language, we've kept its scope narrow in the interest of speed and size. Put another way, the presentation is focused on core concepts and is sometimes deliberately simplistic. Because of that, this book is probably best described as both an introduction and a stepping stone to more advanced and complete texts.
For example, we won't say anything about Python/C integration--a big, complicated topic, with lots of big, complicated examples, which is nevertheless central to many Python-based systems. We also won't talk much about the Python community, Python's history, or some of the philosophies underlying Python development. And popular Python applications such as GUIs, system tools, network scripting, and numeric programming get only a short survey at the end (if they are mentioned at all). Naturally, this misses some of the big picture.
By and large, Python is about raising the quality bar a few notches in the scripting world. Some of its ideas require more context than can be provided here, and we'd be remiss if we didn't recommend further study after you finish this text. We hope that most readers of this book will eventually go on to gain a deeper and more complete understanding, from texts such as O'Reilly's Programming Python. The rest of the Python story requires studying examples that are more realistic than there is space for here.
But despite its limited scope (and perhaps because of it), we think you'll find this to be a great first book on Python. You'll learn everything you need to get started writing useful standalone Python programs and scripts. By the time you've finished this book, you will have learned not only the language itself, but also how to apply it to day-to-day tasks. And you'll be equipped to tackle more advanced topics as they come your way.
Much of this book is based on training materials developed for a three-day hands-on Python course. You'll find exercises at the end of most chapters, with solutions in Appendix C. The exercises are designed to get you coding right away, and are usually one of the highlights of the course. We strongly recommend working through the exercises along the way, not only to gain Python programming experience, but also because some exercises raise issues not covered elsewhere in the text. The solutions at the end should help if you get stuck (we encourage you to cheat as much and as often as you like). Naturally, you'll need to install Python to run the exercises; more on this in a moment.
Because this text is designed to introduce language basics quickly, we've organized the presentation by major language features, not examples. We'll take a bottom-up approach here: from built-in object types, to statements, to program units, and so on (in fact, if you've seen Appendix E in Programming Python, parts of this book may stir up feelings of deja vu). Each chapter is fairly self-contained, but later chapters use ideas introduced in earlier ones (e.g., by the time we get to classes, we'll assume you know how to write functions), so a linear reading probably makes the most sense. From a broader perspective, this book is divided into three sections:
This part of the book presents the Python language, in a bottom-up fashion. It's organized with one chapter per major language feature--types, functions, and so forth--and most of the examples are small and self-contained (some might also call the examples in this section artificial, but they illustrate the points we're out to make). This section represents the bulk of the text, which tells you something about the focus of the book.
In this section, we sample Python's built-in tools, and put them to use in a more or less random collection of small example programs.
The book ends with three appendixes that list Python resources on the Net (Appendix A), give platform-specific tips for using Python on Unix, Windows, and Macintosh-based machines (Appendix B), and provide solutions to exercises that appear at the end of chapters (Appendix C). Note: the index can be used to hunt for details, but there are no reference appendixes in this book per se. The Python Pocket Reference from O'Reilly (http://www.ora.com), as well as the free Python reference manuals maintained at http://www.python.org, will fill in the details.
There are none to speak of, really. This is an introductory-level book. It may not be an ideal text for someone who has never touched a computer before (for instance, we're not going to spend a lot of time explaining what a computer is), but we haven't made many assumptions about your programming background or education. On the other hand, we won't insult readers by assuming they are "dummies" either (whatever that means); it's easy to do useful things in Python, and we hope to show you how. The text occasionally contrasts Python with languages such as C, C++, and Pascal, but you can safely ignore these comparisons if you haven't used such languages in the past.
One thing we should probably mention up front: Python's creator, Guido van Rossum, named it after the BBC comedy series Monty Python's Flying Circus. Because of this legacy, many of the examples in this book use references to that show. For instance, the traditional "foo" and "bar" become "spam" and "eggs" in the Python world. You don't need to be familiar with the series to make sense of the examples (symbols are symbols), but it can't hurt.
Back to my Learning Python page
Back to my homepage