Categories
Bibliography Python Software Engineering

Python Pocket Reference, by Mark Lutz

See also: Python, Python Bibliography and Bibliography of Python Libraries and Web Frameworks, Programming Python: Powerful Object-Oriented Programming by Mark Lutz, Learning Python: Powerful Object-Oriented Programming by Mark Lutz

Python Pocket Reference: Python In Your Pocket, by Mark Lutz, B00HZ41PGC (PPR)

Fair Use Source: B00HZ41PGC (PPR)

About This Book:

Updated for both Python 3.4 and 2.7, this convenient pocket guide is the perfect on-the-job quick reference. You’ll find concise, need-to-know information on Python types and statements, special method names, built-in functions and exceptions, commonly used standard library modules, and other prominent Python tools. The handy index lets you pinpoint exactly what you need.

Written by Mark Lutz—widely recognized as the world’s leading Python trainer—Python Pocket Reference is an ideal companion to O’Reilly’s classic Python tutorials, Learning Python and Programming Python, also written by Mark.

This fifth edition covers:

  • Built-in object types, including numbers, lists, dictionaries, and more
  • Statements and syntax for creating and processing objects
  • Functions and modules for structuring and reusing code
  • Python’s object-oriented programming tools
  • Built-in functions, exceptions, and attributes
  • Special operator overloading methods
  • Widely used standard library modules and extensions
  • Command-line options and development tools
  • Python idioms and hints
  • The Python SQL Database API

About the Author:

Mark Lutz is a leading Python trainer, the author of Python’s earliest and best-selling texts, and a pioneering figure in the Python world.

Mark is the author of the three O’Reilly books: Learning PythonProgramming Python, and Python Pocket Reference, all currently in fourth or fifth editions. He has been using and promoting Python since 1992, started writing Python books in 1995, and began teaching Python classes in 1997. As of Spring 2013, Mark has instructed 260 Python training sessions, taught roughly 4,000 students in live classes, and written Python books that have sold 400,000 units and been translated to at least a dozen languages.

Together, his two decades of Python efforts have helped to establish it as one of the most widely used programming languages in the world today. In addition, Mark has been in the software field for 30 years. He holds BS and MS degrees in computer science from the University of Wisconsin where he explored implementations of the Prolog language, and over his career has worked as a professional software developer on compilers, programming tools, scripting applications, and assorted client/server systems.

Book Details:

  • ASIN: B00HZ41PGC
  • ISBN-10: 1449357016
  • ISBN-13: 978-1449357016
  • Publisher: O’Reilly Media; 5th edition (January 22, 2014)
  • Publication date: January 22, 2014
  • Print length: 334 pages

Introduction:

“Python is a general-purpose, multiparadigm, open source computer programming language, with support for object-oriented, functional, and procedural coding structures. It is commonly used both for standalone programs and for scripting applications in a wide variety of domains, and is generally considered to be one of the most widely used programming languages in the world.” (PPR)

“Among Python’s features are an emphasis on code readability and library functionality, and a design that optimizes developer productivity, software quality, program portability, and component integration. Python programs run on most platforms in common use, including Unix and Linux, Windows and Macintosh, Java and .NET, Android and iOS, and more.” (PPR)

“This pocket reference summarizes Python types and statements, special method names, built-in functions and exceptions, commonly used standard library modules, and other prominent Python tools. It is intended to serve as a concise reference tool for developers and is designed to be a companion to other books that provide tutorials, code examples, and other learning materials.” (PPR)

“This fifth edition covers both Python 3.X and 2.X. It focuses primarily on 3.X, but also documents differences in 2.X along the way. Specifically, this edition has been updated to be current with Python versions 3.3 and 2.7 as well as prominent enhancements in the imminent 3.4 release, although most of its content also applies both to earlier and to later releases in the 3.X and 2.X lines.” (PPR)

“This edition also applies to all major implementations of Python — including CPython, PyPy, Jython, IronPython, and Stackless — and has been updated and expanded for recent changes in language, libraries, and practice. Its changes include new coverage of the MRO and super(); formal algorithms of inheritance, imports, context managers, and block indentation; and commonly used library modules and tools, including json, timeit, random, subprocess, enum, and the new Windows launcher.” (PPR)

Note:

“In this book, “3.X” and “2.X” mean that a topic applies to all commonly used releases in a Python line. More specific release numbers are used for topics of more limited scope (e.g., “2.7” means 2.7 only). Because future Python changes can invalidate applicability to future releases, also see Python’s “What’s New” documents, currently maintained at https://docs.python.org/3/whatsnew/index.html for Pythons released after this book.” (PPR)

Table of Contents:

Detailed Table of Contents:

Introduction

Book Conventions

Python Command-Line Usage

Python Command Options

Command-Line Program Specification

Python 2.X Command Options

Python Environment Variables

Python Operational Environment Variables

Python Command Option Environment Variables

Python Windows Launcher Usage

Python Windows Launcher File Directives

Python Windows Launcher Command Lines

Python Windows Launcher Environment Variables


Python Built-in Types and Operators

Python Operators and Precedence

Python Atomic terms and Python dynamic typing

Python Operator Usage Notes

Python Operations by Category

Python Sequence Operation Notes


Python Specific Built-in Types

  • Python Unicode Strings
    • Unicode support in Python 3.X
    • Python byte string and Python bytearray strings
    • Unicode support in Python 2.X
  • Python Lists
    • Python List Literals and creation
    • Python List Operations
    • Python List comprehension expressions
    • The Python iteration protocol
    • Python Generator expressions
    • Other Python comprehension expressions

  • Python Dictionaries
    • Python Dictionary Literals and creation
    • Python Dictionary Operations

  • Python Tuples
    • Python Tuple Literals and creation
    • Python Tuple Operations

  • Python Files
    • Python Input files
    • Python Output files
    • Any files with Python
    • Other Python file attributes (some read-only)
    • Python File context managers
    • Python File usage notes

  • Python Sets
    • Python Set Literals and creation
    • Python Set Operations

  • Other Python Types and Conversions
    • Python Boolean
    • Python Type Conversions

Python Statements and Python Syntax:

  • Python Syntax Rules
  • Python Name Rules
    • Python Name format
    • Python Name conventions

Specific Python Statements:

  • The Python Assignment Statement
    • Python Augmented assignment
    • Python Normal sequence assignment
    • Python Extended sequence assignment (3.X)
  • The Python Expression Statement
    • Python Call syntax
    • Python Arbitrary arguments call syntax
  • The Python print Statement
    • Python 2.X print statements
  • The Python if Statement
  • The Python while Statement
  • The Python for Statement
  • The Python pass Statement
  • The Python break Statement
  • The Python continue Statement
  • The Python del Statement
  • The Python def Statement
    • Python 3.X keyword-only arguments
    • Python 3.X function annotations
    • Python lambda expressions
    • Python Function defaults and Python attributes
    • Python Function decorators and Python method decorators
  • The Python return Statement
  • The Python yield Statement
    • Python Generator function changes in Python 3.3
  • The Python global Statement
  • The Python nonlocal Statement
  • The Python import Statement
    • Python Package imports
    • Python 3.3 namespace packages
    • Python Import algorithm
  • The Python from Statement
    • Python Package relative import syntax
  • The Python class Statement
    • Python Class decorators in Python 3.X, 2.6, and 2.7
    • Python Metaclasses
  • The try Statement
    • Python 2.X try statement forms
  • The Python raise Statement
    • Python 3.X chained exceptions
    • Python Class exceptions
    • Python 2.X raise statement forms
  • The Python assert Statement
  • The Python with Statement
    • Multiple context managers in Python 3.1 and 2.7
    • Python Context manager protocol
  • Python 2.X Statements

Python Namespace Rules and Python Scope Rules:

Python Qualified Names: Python Object Namespaces

Python Unqualified Names: Python Lexical Scopes

Python Nested Scopes and Python Closures

Enclosing Python scopes and Python defaults


Python Object-Oriented Programming:

Python Classes and Python Instances

Python Class objects provide default behavior

Python Instance objects are generated from Python classes

Python Inheritance rules

Python Pseudoprivate Attributes

Python Module privates

Python Class privates

New-Style Python Classes

Python Formal Inheritance Rules

Python Classic classes: DFLR

New-style Python classes: MRO

Example: nondiamonds

Example: diamonds

New-style Python inheritance algorithm

New-style Python precedence and Python context


Python Operator Overloading Methods:

Python Methods for All Types

Python Methods for Collections (Python Sequences, Python Mappings)

Python Methods for Numbers (Python Binary Operators)

Basic Python binary methods

Python Right-side binary methods

Python Augmented binary methods

Python Methods for Numbers (Other Python Operations)

Python Methods for Descriptors

Python Methods for Context Managers

Python 2.X Operator Overloading Methods

Methods in Python 3.X only

Methods in Python 2.X only


Python Built-in Functions:

Python 2.X Built-in Functions

Python 3.X built-ins not supported by Python 2.X

Python 2.X built-ins not supported by Python 3.X


Built-in Python Exceptions:

Python Superclasses: Categories

Specific Python Exceptions

Specific Python OSError Exceptions

Python Warning Category Exceptions

Python Warnings Framework

Python 3.2 Built-in Exceptions

Python 2.X Built-in Exceptions


Python Built-in Attributes:


Python Standard Library Modules:


The Python sys Module:


The Python string Module:

Python Functions and Python Classes

Python Constants


The Python os System Module:

Python Administrative Tools

Python Portability Constants

Python Shell Commands

Python Environment Tools

Python File Descriptor Tools

Python File Pathname Tools

Python Process Control

The Python os.path Module


The Python re Pattern-Matching Module:

Module Functions

Python Regular Expression Objects

Python Match Objects

Python Regex Pattern Syntax


Python Object Persistence Modules:

The Python shelve Module and Python dbm Module

Python File opens

Python File operations

The Python pickle Module

Python Pickling interfaces

Python Unpickling interfaces

Python pickle usage notes


The Python tkinter GUI Module and Tools:

Python tkinter Example

Python tkinter Core Widgets

Python Common Dialog Calls

Python Module tkinter.messagebox (tkMessageBox in Python 2.X)

Module tkinter.simpledialog (tkSimpleDialog in Python 2.X)

Python Module tkinter.colorchooser (tkColorChooser in Python 2.X)

Python Module tkinter.filedialog (tkFileDialog in Python 2.X)

Additional Python tkinter Classes and Tools

Python Tcl/Tk-to-Python/tkinter Mappings


Python Internet Modules and Tools:


Other Python Standard Library Modules:

The Python math Module

The Python time Module

The Python timeit Module

The Python datetime Module

The Python random Module

The Python json Module

The Python subprocess Module

The Python enum Module

The Python struct Module

Python Threading Modules


Python SQL Database API:

Python SQL Database API Usage Example

Python SQL Database Module Interface

Python SQL Database Connection Objects

Python SQL Database Cursor Objects

Python SQL Database Type Objects and Python SQL Database Constructors


More Python Hints and Python Idioms:

Python Core Language Hints

Python Environment Hints

Python Usage Hints

Assorted Python Hints


Python Index of Topics

Copyright


Sources:

Fair Use Sources: