Python Essential Reference

Python Essential Reference

by David Beazley

Paperback(Revised Edition)

$44.99 View All Available Formats & Editions

Product Details

ISBN-13: 9780672328626
Publisher: Sams
Publication date: 02/24/2006
Series: Developer's Library Series
Edition description: Revised Edition
Pages: 648
Product dimensions: 6.04(w) x 8.94(h) x 1.08(d)

About the Author


David M. Beazley is the developer of SWIG, a popular software package for integrating C and C++ software with interpreted languages including Python, Perl, and Tcl. Dave spent seven years working in the Theoretical Physics Division at Los Alamos National Laboratory and has been at the forefront of integrating Python with high-performance simulation software running on parallel computers. Dave is currently an assistant professor in the Department of Computer Science at the University of Chicago where he enjoys tormenting students with insane systems programming projects.

Read an Excerpt

IntroductionIntroduction

THIS BOOK IS INTENDED TO BE A CONCISE REFERENCE to the Python programming language. Although an experienced programmer will probably be able to learn Python from this book, it's not intended to be an extended tutorial or a treatise on how to program. Rather, the goal is to present the core Python language, the contents of the Python library, and the Python extension API in a manner that's accurate and concise. This book assumes that the reader has prior programming experience with Python or another language such as C or Java. In a addition, a general familiarity with systems programming topics (for example, basic operating system concepts and network programming) may be useful in understanding certain parts of the library reference.

Python is freely available for download at http://www.python.org. Versions are available for almost every operating system, including UNIX, Windows, Macintosh, and Java. In addition, the Python website includes links to documentation, how-to guides, and a wide assortment of third-party software.

The contents of this book are based on Python 2.4. However, readers should be aware that Python is a constantly evolving language. Most of the topics described herein are likely to be applicable to future versions of Python 2.x. In addition, much of the material is applicable to earlier releases. To a lesser extent, the topics in this book also apply to alternative Python implementations such as Jython (an implementation of Python in Java) and IronPython (an implementation of Python for .NET). However, those implementations are not the primary focus.

Just as Python is an evolving language, the third edition ofPython Essential Reference has evolved to make use of new language features and new library modules. In fact, since the publication of the second edition, Python has undergone a dramatic transformation involving significant changes to core parts of the language. In addition, a wide variety of new and interesting features have been added. Rather than discussing these changes as a mere afterthought, the entire text has been updated to reflect the modern state of Python programming. Although no distinction is given to new features, detailed descriptions of language changes can be found at http://www.python.org.

Finally, it should be noted that Python already includes thousands of pages of useful documentation. The contents of this book are largely based on that documentation, but with a number of key differences. First, this reference presents most of the same information in a much more compact form, with different examples, and alternative descriptions of many topics. Second, a significant number of topics in the library reference have been expanded to include outside reference material. This is especially true for low-level system and networking modules in which effective use of a module normally relies on a myriad of options listed in manuals and outside references. In addition, in order to produce a more concise reference, a number of deprecated and relatively obscure library modules have been omitted. Finally, this reference doesn't attempt to cover large frameworks such as Tkinter,

In writing this book, it has been my goal to produce a reference containing virtually everything I have needed to use Python and its large collection of modules. Although this is by no means a gentle introduction to the Python language, I hope that you find the contents of this book to be a useful addition to your programming reference library for many years to come. I welcome your comments.

David Beazley
Chicago, Illinois
November 27, 2005

© Copyright Pearson Education. All rights reserved.

Table of Contents

1. A Tutorial Introduction to Python.
2. Lexical conventions and syntax.
3. Types and Objects.
4. Operators and Expressions.
5. Control Flow.
6. Functions and Functional Programming.
7. Classes and Object-Oriented Programming.
8. Modules and Packages.
9. Input and Output.
10. Execution Environment.
Appendix A: The Python Library.
Appendix B: Python C API.
Index.

Introduction

This book is intended to be a concise reference to the Python programming language. Although an experienced programmer will probably be able to learn Python from this book, it's not intended to be an extended tutorial or a treatise on software design. Rather, the goal is to present the core Python language, the contents of the Python library, and the Python extension API in a manner that's accurate and succinct. This book assumes that the reader has prior programming experience with Python or other languages such as C or Java. In addition, a general familiarity with systems programming topics (for example, basic operating system calls, process management, and network programming) may be useful in understanding certain parts of the library reference.

Python is freely available for download at http:// www. python.org.Versions are available for Unix, Windows, Macintosh, and Java. In addition, this site includes links to documentation, how-to guides, and a wide assortment of extension modules.

The contents of this book are based on Python 1.5.2. However, readers should be aware that Python is a constantly evolving language. Most of the topics described herein are likely to be applicable to future versions of Python 1.x. In addition, most topics are applicable to earlier releases. To a lesser extent, the topics in this book also apply to JPython, an implementation of Python entirely in Java. However, as of this writing, JPython is still in beta release and undergoing active development-making it a difficult target for up-to-date reference material.

Finally, it should be noted that Python is distributed with well over 500 pages of reference documentation. The contents of thisbook are largely based on this documentation, but with a number of enhancements, additions, and omissions. First, this reference presents most of the same material in a more compact form with different examples and alternative descriptions of many topics. Second, a number of topics in the library reference have been expanded to include additional outside reference material. This is especially true for low-level system and networking modules in which effective use of a module normally relies on a myriad of options listed in Unix manual pages and outside reference material. In addition, in order to produce a more concise reference, a number of deprecated and relatively obscure library modules have been omitted. Finally, this reference doesn't attempt to cover large frameworks such as Tkinter or the COM extension, as these topics are beyond the scope of this book and are described in books of their own.

In writing this book, it has been my goal to produce a reference containing virtually everything I have needed to use Python and its large collection of modules. To do this, I have incorporated and condensed a considerable amount of information from manual pages, online documentation, and several thousand pages of systems programming books. Although this is by no means a gentle introduction to the Python language, I hope that you find the contents of this book to be a useful addition to your programming reference library for many years to come. I welcome your comments.

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews

Python Essential Reference 4.5 out of 5 based on 0 ratings. 2 reviews.
Guest More than 1 year ago
The author did a great job of including a ton of information in a clear and succinct reference. This is not a book that will teach a newbie all about programming. However, it is perfect for those that have at least some programming experience, whether in Python or some other language, and need a reference while coding in Python.
For those new to the language who find themselves wondering 'How do I do that in Python?', the first chapter includes a short (11 page) tutorial that demonstrates using:
- Variables
- Conditionals
- File I/O
- Strings
- Lists & Tuples
- Loops
- Dictionaries
- Functions
- Classes
- Exceptions
- Modules
The tutorial section is nice while getting up to speed with Python's syntax.
The rest of the book goes into a bit more detail on rest of the Python's language features with the exception of some of the more inconspicuous ones. Most of the 'raw' information in the book is available on python.org or other online resources, but with the book you get that same information filtered through the author's Python experience plus a lot of concise examples. I've found that what is not covered in this book is better answered by searching the related mailing list archives.
As with the other New Riders programming books I own, this one is indexed well, making it easy to find what I am looking for. Also, the size of the book is small enough that it fits nicely in my briefcase and on my desktop.
It appears that a lot of thought went into both the content of the book as well as the overall design of the reference, that's why I've given it the highest rating.
DSD on LibraryThing 28 days ago
A very good reference for the Python programming language. The book is based on version 1.5.2 of Python so it might be a bit dated by now. It is broken up into two sections. The first, and smaller, section covers the language itself with useful examples throughout. The second section consists of two appendicies which cover the Python libraries and extending and embedding Python.From the back cover - Python Essential Reference is a definitive guide to the Python programming language. Designed for programmers, it covers the core language, more than 100 modules in the standard library, and the extension building techniques used to integrate Python with programs written in C and C++. Coverage expands upon and clarifies existing Python documentation - especially for advanced topics including operating system interfaces, threads, and network programming.