Ask any Python aficionado and you'll hear that Python programmers have it all: an elegant language that offers object-oriented programming support, a readable, maintainable syntax, integration with C components, and an enormous collection of precoded standard library and extension modules. Moreover, Python is easy to learn but powerful enough to take on the most ambitious programming challenges. But what Python programmers have lacked is one concise and clear reference resource, with the appropriate measure of guidance in how best to use Python's great power. Now Python in a Nutshell fills this need.
In the tradition of O'Reilly's "In a Nutshell" series, this book offers Python programmers one place to look when they need help remembering or deciphering the syntax of this open source language and its many modules. This comprehensive reference guide makes it easy to look up all the most frequently needed information--not just about the Python language itself, but also the most frequently used parts of the standard library and the most important third-party extensions.
Python in a Nutshell focuses on Python 2.2 (and all its point releases), currently the most stable and widespread Python release. This book includes:
A fast-paced tutorial on the syntax of the Python language itself
An explanation of object-oriented programming in Python, covering both the classic and new-style object models
Coverage of other core topics, including exceptions, modules, strings, and regular expressions
A quick reference for Python's built-in types and functions, as well as the key modules in the Python standard library, including sys, os, time, thread, math, and socket, among many others
Reference material on important third-party extensions, such as Numeric and Tkinter
Information about extending Python and embedding it into other applications
Python in a Nutshell provides a solid, no-nonsense quick reference to information that programmers rely on the most. This latest addition to the best-selling "In a Nutshell" series will immediately earn its place in any Python programmer's library.
Getting Started with Python
Chapter 1 Introduction to Python
The Python Language
The Python Standard Library and Extension Modules
Python Development and Versions
Chapter 2 Installation
Installing Python from Source Code
Installing Python from Binaries
Chapter 3 The Python Interpreter
The python Program
Python Development Environments
Running Python Programs
The Jython Interpreter
Core Python Language and Built-ins
Chapter 4 The Python Language
Variables and Other References
Expressions and Operators
The print Statement
Control Flow Statements
Chapter 5 Object-Oriented Python
Classic Classes and Instances
New-Style Classes and Instances
Chapter 6 Exceptions
The try Statement
The raise Statement
Custom Exception Classes
Chapter 7 Modules
The Distribution Utilities (distutils)
Chapter 8 Core Built-ins
The sys Module
The getopt Module
The copy Module
The bisect Module
The UserList, UserDict, and UserString Modules
Chapter 9 Strings and Regular Expressions
Methods of String Objects
The string Module
The pprint Module
The repr Module
Regular Expressions and the re Module
Python Library and Extension Modules
Chapter 10 File and Text Operations
The os Module
Auxiliary Modules for File I/O
The StringIO and cStringIO Modules
Text Input and Output
Interactive Command Sessions
Chapter 11 Persistence and Databases
The Berkeley DB Module
The Python Database API (DBAPI) 2.0
Chapter 12 Time Operations
The time Module
The sched Module
The calendar Module
The mx.DateTime Module
Chapter 13 Controlling Execution
Dynamic Execution and the exec Statement
Site and User Customization
Chapter 14 Threads and Processes
Threads in Python
The thread Module
The Queue Module
The threading Module
Threaded Program Architecture
Running Other Programs
The mmap Module
Chapter 15 Numeric Processing
The math and cmath Modules
The operator Module
The random Module
The array Module
The Numeric Package
Universal Functions (ufuncs)
Optional Numeric Modules
Chapter 16 Tkinter GUIs
Commonly Used Simple Widgets
The Text Widget
The Canvas Widget
Chapter 17 Testing, Debugging, and Optimizing
The warnings Module
Network and Web Programming
Chapter 18 Client-Side Network Protocol Modules
The HTTP and FTP Protocols
Chapter 19 Sockets and Server-Side Network Protocol Modules
Alex Martelli spent 8 years with IBM Research, winning three Outstanding Technical Achievement Awards. He then spent 13 as a Senior Software Consultant at think3 inc, developing libraries, network protocols, GUI engines, event frameworks, and web access frontends. He has also taught programming languages, development methods, and numerical computing at Ferrara University and other venues. He's a C++ MVP for Brainbench, and a member of the Python Software Foundation. He currently works for AB Strakt, a Python-centered software house in Gteborg, Sweden, mostly by telecommuting from his home in Bologna, Italy. Alex's proudest achievement is the articles that appeared in Bridge World (January/February 2000), which were hailed as giant steps towards solving issues that had haunted contract bridge theoreticians for decades.
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of Python in a Nutshell is an African rock python, one of approximately 18 species of python. Pythons are nonvenomous constrictor snakes that live in tropical regions of Africa, Asia, Australia, and some Pacific Islands. Pythons live mainly on the ground, but they are also excellent swimmers and climbers. Both male and female pythons retain vestiges of their ancestral hind legs. The male python uses these vestiges, or spurs, when courting a female.
The python kills its prey by suffocation. While the snake's sharp teeth grip and hold the prey in place, the python's long body coils around its victim's chest, constricting tighter each time it breathes out. They feed primarily on mammals and birds. Python attacks on humans are extremely rare. Emily Quill was the production editor and copyeditor for Python in a Nutshell. Linley Dolby and Tatiana Apandi Diaz provided quality control. Philip Dangler, Judy Hoer, and Genevieve d'Entremont provided production assistance. Nancy Crumpton wrote the index.
Emma Colby designed the cover ofthis book, based on a series design by Edie Freedman. The cover image is a 19th-century engraving from the Dover Pictorial Archive. Emma Colby produced the cover layout with QuarkXPress 4.1 using Adobe's ITC Garamond font.
Bret Kerr designed the interior layout, based on a series design by David Futato. This book was converted by Mike Sierra to FrameMaker 5.5.6 with a format conversion tool created by Erik Ray, Jason McIntosh, Neil Walls, and Mike Sierra that uses Perl and XML technologies. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSans Mono Condensed. The illustrations that appear in the book were produced by Robert Romano and Jessamyn Read using Macromedia FreeHand 9 and Adobe Photoshop 6. This colophon was written by Nicole Arigo.
I've read around 15 books on Python by now, and this is definitely the best for understanding how to make good use of Python. Alex Martelli is profoundly knowledgable about Python, which is also evident from the Python Cookbook.
It's an excellent reference, it covers more areas than the other books I've read and in the Network and Web Programming part it compares different frameworks for writing Internet applications. It was from this parts recommendation that I started to use twisted that has turned out to be really great for making advanced server and client applications.
Beginners should not start with this book, but rather Learning Python 1st edition (the 2nd ed. is a bit longish and explains too much for beginners) or even better: Quick Python. However, both of these are a bit out of date.
Worst Python book by ORA since Learning Python. Why can't some publisher find a good writer that knows Python. Obviously, ORA can't. I was really looking forward to the release of this book and have been very disappointed. I'm only on Chapter 5, but am dusting off my Python 2.1 Bible and giving it another chance. The quality of books from ORA seem to be declining rapidly. Hopefully, this will be changed.
This is a great book, or will be in the corrected printing. The errata page shows that there is on average one error per twenty-five pages. And I'm generously counting the index in the page count. This is far too many errors for such an important volume. ORA should have invested the resources and time to do better. This community will wait for -- and reward -- quality.
Being a ObjectiveC developer of yore, I had changed sides a long time ago to become a pure user and earn a living as a banker. After nearly ten years of abstinence I was recently introduced to Python by a student working at our office. Happy to recognize many of the concepts of ObjectiveC I decided to learn Python for pure fun. I found the online documentation not as helpful as proclaimed on python.org, but I got into Python with the help of 'Learning Python' by Mark Lutz and then got on with 'Programming Python' by Mark Lutz.
What I was missing dearly, however, was a concise but comprehensive reference book. In 'Python in a Nutshell' I have found what I had been looking for and more. Aimed at Python programmers with some prior knowledge of Python, it is not exactly a starting point for beginners, but it is a truly excellent guide to programmers conversant with other programming languages. The book is well organized and clearly arranged with a good index. It offers all the syntactic and morphologic specifications required for application development, accompanied by well written code samples. The coverage of Tkinter is brief (I am still looking for a thorough coverage of that topic), but sufficient for a reference book. In short, I am happy with Alex Martelli's work - it is sitting next to my keyboard all the time !