Create bookmark
Python in a Nutshell
Notes
Please login to add notes
- Table of Contents
-
+
Preface
- I
-
+
Introduction to Python
-
+
Installation
-
+
The Python Interpreter
- II
- + The Python Language
-
+
Object-Oriented Python
- + Classes and Instances
-
+
Special Methods
- + General-Purpose Special Methods
- + Special Methods for Containers
-
+
Special Methods for Numeric Objects
- __abs__, __invert__, __neg__, __pos__
- __add__, __div__, __floordiv__, __mod__, __mul__, __sub__, __truediv__
- __and__, __lshift__, __or__, __rshift__, __xor__
- __coerce__
- __complex__, __float__, __int__, __long__
- __divmod__
- __hex__, __oct__
- __iadd__, __idiv__, __ifloordiv__, __imod__, __imul__, __isub__, __itru...
- __iand__, __ilshift__, __ior__, __irshift__, __ixor__
- __index__
- __ipow__
- __pow__
- __radd__, __rdiv__, __rmod__, __rmul__, __rsub__
- __rand__, __rlshift__, __ror__, __rrshift__, __rxor__
- __rdivmod__
- __rpow__
- Decorators
- + Metaclasses
-
+
Exceptions
-
+
Modules
-
+
Core Built-ins
-
+
Strings and Regular Expressions
- III
-
+
File and Text Operations
- Other Chapters That Also Deal with Files
- Organization of This Chapter
-
+
File Objects
-
+
Auxiliary Modules for File I/O
- + The StringIO and cStringIO Modules
-
+
Compressed Files
- + The os Module
-
+
Filesystem Operations
- + Text Input and Output
- + Richer-Text I/O
-
+
Interactive Command Sessions
-
+
Internationalization
- + Persistence and Databases
-
+
Time Operations
- + The time Module
- + The datetime Module
- + The pytz Module
- + The dateutil Module
- + The sched Module
- + The calendar Module
-
+
The mx.DateTime Module
- Date and Time Types
-
+
The DateTime Type
- Factory functions for DateTime
- DateTime, Date, Timestamp
- DateTimeFrom, TimestampFrom
- DateTime- FromAbsDays
- DateTime- FromCOMDate
- DateFromTicks
- gmt, utc
- gmtime, utctime
- localtime
- mktime
- now
- Timestamp- FromTicks
- today
- Methods of DateTime instances
- absvalues
- COMDate
- gmticks
- gmtime
- gmtoffset
- localtime
- strftime, Format
- ticks
- tuple
- Attributes of DateTime instances
- Arithmetic on DateTime instances
- + The DateTimeDelta Type
- + Other Attributes
- Submodules
-
+
Controlling Execution
-
+
Threads and Processes
-
+
Numeric Processing
-
+
Array Processing
- + The array Module
- Extensions for Numeric Array Computation
- The Numeric Package
-
+
Array Objects
- Typecodes
- Shape and Indexing
- Storage
- + Slicing
- Truth Values and Comparisons of Arrays
- + Factory Functions
- + Attributes and Methods
- + Operations on Arrays
-
+
Functions
- allclose
- argmax, argmin
- argsort
- around
- array2string
- average
- choose
- clip
- compress
- concatenate
- convolve
- cross_correlate
- diagonal
- dot
- indices
- innerproduct
- matrixmultiply
- nonzero
- outerproduct
- put
- putmask
- rank
- ravel
- repeat
- reshape
- resize
- searchsorted
- shape
- size
- sort
- swapaxes
- take
- trace
- transpose
- vdot
- where
- + Universal Functions (ufuncs)
- Auxiliary Numeric Modules
- + Tkinter GUIs
-
+
Testing, Debugging, and Optimizing
- IV
-
+
Client-Side Network Protocol Modules
-
+
Sockets and Server-Side Network Protocol Modules
-
+
The socket Module
- + The SocketServer Module
-
+
Event-Driven Socket Programs
- + The select Module
- + The asyncore and asynchat Modules
-
+
The Twisted Framework
- The twisted.internet and twisted.protocols packages
- Reactors
- callLater
- callInThread
- callFromThread
- callWhenRun- ning
- connectTCP
- listenTCP
- run
- stop
- Transports
- getHost
- getPeer
- loseConnection
- write
- writeSequence
- Protocol handlers and factories
- connectionLost
- connection- Made
- dataReceived
- makeConnec- tion
- Echo server using Twisted
-
+
The socket Module
-
+
CGI Scripting and Alternatives
-
+
MIME and Network Encodings
- + Encoding Binary Data as Text
-
+
MIME and Email Format Handling
-
+
Structured Text: HTML
-
+
Structured Text: XML
- An Overview of XML Parsing
- + Parsing XML with SAX
-
+
Parsing XML with DOM
- The xml.dom Package
-
+
The xml.dom.minidom Module
- parse
- parseString
- Node objects
- attributes
- childNodes
- firstChild
- hasChildNodes
- isSameNode
- lastChild
- localName
- namespaceURI
- nextSibling
- nodeName
- nodeType
- nodeValue
- normalize
- ownerDocument
- parentNode
- prefix
- previousSibling
- Attr objects
- ownerElement
- specified
- Document objects
- doctype
- document- Element
- getElementById
- getElementsBy- TagName
- getElementsBy- TagNameNS
- Element objects
- getAttribute
- getAttributeNS
- getAttribute- Node
- getAttribute- NodeNS
- getElementsBy- TagName
- getElementsBy- TagNameNS
- hasAttribute
- hasAttributeNS
- Parsing XHTML with xml.dom.minidom
- + The xml.dom.pulldom Module
- Parsing XHTML with xml.dom.pulldom
-
+
Changing and Generating XML
- V
-
+
Extending and Embedding Classic Python
-
+
Extending Python with Python’s C API
- + Building and Installing C-Coded Python Extensions
- Overview of C-Coded Python Extension Modules
- Return Values of Python’s C API Functions
- + Module Initialization
- Reference Counting
- + Accessing Arguments
- + Creating Python Values
- + Exceptions
-
+
Abstract Layer Functions
- PyCallable_ Check
- PyEval_ CallObject
- PyEval_ CallObjectWith- Keywords
- PyIter_Check
- PyIter_Next
- PyNumber_ Check
- PyObject_ CallFunction
- PyObject_ CallMethod
- PyObject_Cmp
- PyObject_ DelAttrString
- PyObject_ DelItem
- PyObject_ DelItemString
- PyObject_ GetAttrString
- PyObject_ GetItem
- PyObject_ GetItemString
- PyObject_ GetIter
- PyObject_ HasAttrString
- PyObject_IsTrue
- PyObject_ Length
- PyObject_ Repr
- PyObject_ RichCompare
- PyObject_ RichCompare- Bool
- PyObject_ SetAttrString
- PyObject_ SetItem
- PyObject_ SetItemString
- PyObject_Str
- PyObject_Type
- PyObject_ Unicode
- PySequence_ Contains
- PySequence_ DelSlice
- PySequence_ Fast
- PySequence_ Fast_GET_ITEM
- PySequence_ Fast_GET_SIZE
- PySequence_ GetSlice
- PySequence_ List
- PySequence_ SetSlice
- PySequence_ Tuple
- PyNumber_ Power
- + Concrete Layer Functions
- A Simple Extension Example
- + Defining New Types
- Extending Python Without Python’s C API
-
+
Embedding Python
- + Pyrex
-
+
Extending Python with Python’s C API
-
+
Extending and Embedding Jython
- + Distributing Extensions and Programs
- Index
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 powerful but scantily documented modules. This comprehensive reference guide makes it easy to look up 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.
Ask any Python aficionado and you'll hear that Python programmers have it all: an elegant object-oriented language with readable and maintainable syntax, that allows for easy integration with components in C, C++, Java, or C#, and an enormous collection of precoded standard library and third-party extension modules. Moreover, Python is easy to learn, yet powerful enough to take on the most ambitious programming challenges. But what Python programmers used to lack is a concise and clear reference resource, with the appropriate measure of guidance in how best to use Python's great power. Python in a Nutshell fills this need.
Python in a Nutshell, Second Edition covers more than the language itself; it also deals with the most frequently used parts of the standard library, and the most popular and important third party extensions. Revised and expanded for Python 2.5, this book now contains the gory details of Python's new subprocess module and breaking news about Microsoft's new IronPython project. Our "Nutshell" format fits Python perfectly by presenting the highlights of the most important modules and functions in its standard library, which cover over 90% of your practical programming needs. This book includes:
A fast-paced tutorial on the syntax of the Python language
An explanation of object-oriented programming in Python
Coverage of iterators, generators, exceptions, modules, packages, strings, and regular expressions
A quick reference for Python's built-in types and functions and key modules
Reference material on important third-party extensions, such as Numeric and Tkinter
Information about extending and embedding Python
Python in a Nutshell provides a solid, no-nonsense quick reference to information that programmers rely on the most. This book will immediately earn its place in any Python programmer's library.
Praise for the First Edition:
"In a nutshell, Python in a Nutshell serves one primary goal: to act as an immediately accessible goal for the Python language. True, you can get most of the same core information that is presented within the covers of this volume online, but this will invariably be broken into multiple files, and in all likelihood lacking the examples or the exact syntax description necessary to truly understand a command."
--Richard Cobbett, Linux Format
"O'Reilly has several good books, of which Python in a Nutshell by Alex Martelli is probably the best for giving you some idea of what Python is about and how to do useful things with it."
--Jerry Pournelle, Byte Magazine
Test the closed alpha on paperc.com
Book Details
Authors
Categories
Computers > Programming Languages > JavaScript
Publishers
Publication year : 2008
License: All rights reserved ©
Times read: 1,075

