Categories
Bibliography Python Software Engineering

Python in a Nutshell: A Desktop Quick Reference

See also: Python, Python Bibliography and Bibliography of Python Libraries and Web Frameworks

See: Python in a Nutshell: A Desktop Quick Reference, 3rd Edition, by Alex Martelli, Anna Ravenscroft, and Steve Holden, 2017, B06Y4DVSBM (PyNutSh)

Fair Use Source: B06Y4DVSBM (PyNutSh)

About This Book:

Useful in many roles, from design and prototyping to testing, deployment, and maintenance, Python is consistently ranked among today’s most popular programming languages. The third edition of this practical book provides a quick reference to the language—including Python 3.5, 2.7, and highlights of 3.6—commonly used areas of its vast standard library, and some of the most useful third-party modules and packages.

Ideal for programmers with some Python experience, and those coming to Python from other programming languages, this book covers a wide range of application areas, including web and network programming, XML handling, database interactions, and high-speed numeric computing. Discover how Python provides a unique mix of elegance, simplicity, practicality, and sheer power.

This edition covers:

  • Python syntax, Object-Oriented Python, standard library modules, and third-party Python packages
  • Python’s support for file and text operations, persistence and databases, concurrent execution, and numeric computations
  • Networking basics, event-driven programming, and client-side network protocol modules
  • Python extension modules, and tools for packaging and distributing extensions, modules, and applications

Reviews:

“Holden, Ravenscroft, and Martelli are well known Python masters. Their exceptional lucidity shines through in one of Python’s best references, covering the core language, libraries, and essential parts of the Python ecosystem.” — Raymond HettingerDistinguished Python Core Developer –

About the Author:

Alex Martelli spent 8 years with IBM Research, then 13 at think3 inc., followed by 4 years as a consultant (mostly for AB Strakt in Göteborg, Sweden), and lately 12 years at Google (currently as tech lead of 1:many tech support for Google Cloud Platform). He has also taught programming languages, development methods, and numerical computing at Ferrara University and other venues. He’s a Fellow of the Python Software Foundation, a winner of the Frank Willison Memorial Award for contributions to the Python community, and a top-page reputation hog on Stack Overflow. Books he’s authored or co-authored include two editions of the Python Cookbook, three of Python in a Nutshell, and “Beautiful Teams.” Dozens of his tech talks at conferences, and interviews with him, are available on YouTube.

Alex’s proudest achievement are the articles that appeared in Bridge World (January and February 2000), which were hailed as giant steps towards solving issues that had haunted contract bridge theoreticians for decades, and still get quoted in current bridge-theoretical literature, after all these years.

Book Details:

  • ASIN: B06Y4DVSBM
  • ISBN-10: 144939292X
  • ISBN-13: 978-1449392925
  • Publisher: O’Reilly Media; 3rd edition (April 7, 2017)
  • Publication date: April 7, 2017
  • Print length: 1164 pages

Table of Contents:

  • Part I, Getting Started with Python
  • Part II, Core Python Language and Built-ins
  • Part III, Python Library and Extension Modules
  • Part IV, Network and Web Programming
  • Part V, Extending, Distributing, v2/v3 Migration

Preface:

“The Python programming language reconciles many apparent contradictions: both elegant and pragmatic, both simple and powerful, it’s very high-level yet doesn’t get in your way when you need to fiddle with bits and bytes, and it’s suitable for programming novices as well as great for experts, too.” (PyNutSh)

“This book is aimed at programmers with some previous exposure to Python, as well as experienced programmers coming to Python for the first time from other languages. The book is a quick reference to Python itself, the most commonly used parts of its vast standard library, and a few of the most popular and useful third-party modules and packages, covering a wide range of application areas, including web and network programming, XML handling, database interactions, and high-speed numeric computing. The book focuses on Python’s cross-platform capabilities and covers the basics of extending Python and embedding it in other applications.” (PyNutSh)

Sources:

Fair Use Sources:

Categories
Bibliography Python Software Engineering

Practices of the Python Pro

See also: Python, Python Bibliography and Bibliography of Python Libraries and Web Frameworks

See: Practices of the Python Pro, by Dane Hillard, 2020, 1617296082 (PrPyPro)

Fair Use Source: 1617296082 (PrPyPro)

About This Book:

Summary

Professional developers know the many benefits of writing application code that’s clean, well-organized, and easy to maintain. By learning and following established patterns and best practices, you can take your code and your career to a new level.
With Practices of the Python Pro, you’ll learn to design professional-level, clean, easily maintainable software at scale using the incredibly popular programming language, Python. You’ll find easy-to-grok examples that use pseudocode and Python to introduce software development best practices, along with dozens of instantly useful techniques that will help you code like a pro.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the technology

Professional-quality code does more than just run without bugs. It’s clean, readable, and easy to maintain. To step up from a capable Python coder to a professional developer, you need to learn industry standards for coding style, application design, and development process. That’s where this book is indispensable.

About the book

Practices of the Python Pro teaches you to design and write professional-quality software that’s understandable, maintainable, and extensible. Dane Hillard is a Python pro who has helped many dozens of developers make this step, and he knows what it takes. With helpful examples and exercises, he teaches you when, why, and how to modularize your code, how to improve quality by reducing complexity, and much more. Embrace these core principles, and your code will become easier for you and others to read, maintain, and reuse.

What’s inside

  • Organizing large Python projects
  • Achieving the right levels of abstraction
  • Writing clean, reusable code Inheritance and composition
  • Considerations for testing and performance

About the reader

For readers familiar with the basics of Python, or another OO language.

Reviews:

“A wealth of information on general software architecture and truths that are applicable to any language.”–David T. Kerns, Rincon Research Corporation

“Get this book, and begin to write Python code like a professional.” –Davide Cadamuro, BMW Group

“Easy-to-follow book with great information on how to design your software for easy scaling and readability.” –Mike Stevens, Silver Hammer Associates

“This will take a Python developer down a path to becoming a pro.” –Joseph Perenia, Sony Interactive Entertainment

About the Author:

Dane Hillard has spent the majority of his development career using Python to build web applications. https://github.com/daneah, https://dev.to/easyaspython, https://easyaspython.com

Book Details:

  • ASIN: 1617296082
  • ISBN-10: 1617296082
  • ISBN-13: 978-1617296086
  • Publisher: Manning Publications; 1st edition (January 14, 2020)
  • Paperback: 248 pages

Table of Contents:

PART 1 WHY IT ALL MATTERS

1 ¦ The bigger picture

PART 2 FOUNDATIONS OF DESIGN

2 ¦ Separation of concerns

3 ¦ Abstraction and encapsulation

4 ¦ Designing for high performance

5 ¦ Testing your software

PART 3 NAILING DOWN LARGE SYSTEMS

6 ¦ Separation of concerns in practice

7 ¦ Extensibility and flexibility

8 ¦ The rules (and exceptions) of inheritance

9 ¦ Keeping things lightweight

10 ¦ Achieving loose coupling

PART 4 WHAT’S NEXT?

11 ¦ Onward and upward

Sources:

Fair Use Sources:

Categories
Bibliography Python Software Engineering

The Well-Grounded Python Developer

See also: Python, Python Bibliography and Bibliography of Python Libraries and Web Frameworks

See: The Well-Grounded Python Developer, by Doug Farrell, 2021, 1617297441 (WlGrPD)

Fair Use Source: 1617297441 (WlGrPD)

About the Technology:

Python is the perfect language for beginning programmers. It is easy to learn, with tons of helpful libraries and tools. Better still, it doesn’t run out of steam when you want to create more advanced applications for web development or machine learning. Once you’ve mastered the syntax of simple Python scripts, it can be a challenge to progress to more ambitious projects. This book helps you on that path.

About This Book:

When you’re new to Python, it can be tough to understand where and how to use its many language features. There’s a dizzying array of libraries, and it’s challenging to fit everything together. The Well-Grounded Python Developer builds on Python skills you’ve learned in isolation and shows you how to unify them into a meaningful whole. As you work through this practical guide, you’ll discover how all the bits of the Python ecosystem connect as you build and modify a typical web server application.

  • Building modules of functionality
  • Creating a well-constructed web server application
  • Using REST to present data dynamically to a user
  • Refactor and decoupling systems to help scale them
  • How to think about the big picture of your application

The Well-Grounded Python Developer teaches you how to write real software in Python by building on the basic language skills you already have. Veteran developer Doug Farrell helps you see the big picture you can create out of small pieces, introducing concepts like modular construction, APIs, and the design of a basic web server. Throughout the book, you’ll practice your skills by building a blogging platform—the kind of web app that’s in high demand by modern businesses. When you’re finished, you’ll have gone from having a basic understanding of Python’s syntax, grammar, and libraries to using them as the tools of a professional software developer.

Reviews:

“I would consider this book a bible of sorts, offering something to every level of Python developer.” — Lee Harding

About the Author:

Doug Farrell has been developing software since 1983, and has worked with Python for over 20 years.

Book Details:

  • ASIN: 1617297441
  • ISBN-10: 1617297441
  • ISBN-13: 978-1-617297441
  • Publisher: Manning Publications; 1st edition, 2021
  • Paperback: 375 pages

Table of Contents:

Brief Contents:

1 Becoming a Pythonista

2 Your Python Environment

3 Names and Namespaces

4 Application Programmers Interface

5 Object-Oriented Coding

6 Exception Handling

7 Web Servers

8 Your First Web Server

9 Your Second Web Server

10 REST: An API Convention

11 Your Third Web Server

12 Persisting Data

13 Persisting the Mini-Blog to a Database

14 Your Fourth Web Server

15 Thinking Big Picture

16 Conclusion

Preface:

“The goal of this book is to take you past beginning Python programming to the point where you think and feel like a software developer. Where the syntax and grammar of Python are not only comfortable for you but become the tools of a craftsman. With these tools you’ll be able to take on bigger and more complex projects.” (WlGrPD)

“I first discovered Python when I moved from the world of Windows development to the Linux environment. I was an accomplished C/C++ developer, but was interested in learning the scripting languages available in Linux. Fortunately, I came across Python because of its strong support for Object Oriented Programming, which I enjoyed in C++. Since then I’ve never looked back, and Python has become my primary language.” (WlGrPD)

“There are a lot of beginner Python books, Python cookbooks and reference titles, and many of them are very good. To get the most from this book you should be past the beginner level and comfortable with Python. My hope is this book provides a middle ground that gives you more context about how and why you should take certain paths when developing a program.” (WlGrPD)

“You’ll take the loops, conditionals and statements you know now and create larger constructs to handle bigger programming challenges. You’ll learn some conventions and patterns that will reduce the cognitive load on you solving smaller syntactic issues and begin to think how to solve the big picture problems. How the tools you have, and will learn about, can be combined to take goal from problem to solution.” (WlGrPD)

“The book does this by taking you along on a development journey to build a web application providing a simple blogging platform. While I think that’s an interesting application to build, the creation of that application isn’t the end goal of the book. The journey is far more important, the ideas and implementation of those ideas as code, is the real value. The chapters progress and build on the previous ones to illustrate why certain choices were made, and how those choices can be altered and improved as more is learned later in the book.” (WlGrPD)

“As developers we are at an interesting place in the history of the industry. Engineering standards are as important in software development as they are in other disciplines. However, the pace of change in the software world changes those standards as well and provides an opportunity for a great deal of craftsmanship and artistry from a developer. Python gives you a powerful palette of tools to express that.” —Doug Farrell (WlGrPD)

Sources:

Fair Use Sources:

Categories
Bibliography Python Software Engineering

Head First Python: A Brain-Friendly Guide

See also: Python, Python Bibliography and Bibliography of Python Libraries and Web Frameworks

See: Head First Python: A Brain-Friendly Guide, by Paul Barry, B01N0GU0OC (HFPy)

Fair Use Source: B01N0GU0OC (HFPy)

About This Book:

Want to learn the Python language without slogging your way through how-to manuals? With Head First Python, you’ll quickly grasp Python’s fundamentals, working with the built-in data structures and functions. Then you’ll move on to building your very own webapp, exploring database management, exception handling, and data wrangling. If you’re intrigued by what you can do with context managers, decorators, comprehensions, and generators, it’s all here. This second edition is a complete learning experience that will help you become a bonafide Python programmer in no time.

Why does this book look so different? Based on the latest research in cognitive science and learning theory, Head First Pythonuses a visually rich format to engage your mind, rather than a text-heavy approach that puts you to sleep. Why waste your time struggling with new concepts? This multi-sensory learning experience is designed for the way your brain really works.

About ‘Head First’ Books

We think of a Head First Reader as a Learner

Learning isn’t something that just happens to you. It’s something you do. You can’t learn without pumping some neurons. Learning means building more mental pathways, bridging connections between new and pre-existing knowledge, recognizing patterns, and turning facts and information into knowledge (and ultimately, wisdom). Based on the latest research in cognitive science, neurobiology, and educational psychology, Head First books get your brain into learning mode.

Here’s how we help you do that:

We tell stories using casual language, instead of lecturing. We don’t take ourselves too seriously. Which would you pay more attention to: a stimulating dinner party companion, or a lecture?

We make it visual. Images are far more memorable than words alone, and make learning much more effective. They also make things more fun.

We use attention-grabbing tactics. Learning a new, tough, technical topic doesn’t have to be boring. The graphics are often surprising, oversized, humorous, sarcastic, or edgy. The page layout is dynamic: no two pages are the same, and each one has a mix of text and images.

Metacognition: thinking about thinking

If you really want to learn, and you want to learn more quickly and more deeply, pay attention to how you pay attention. Think about how you think. The trick is to get your brain to see the new material you’re learning as Really Important. Crucial to your well-being. Otherwise, you’re in for a constant battle, with your brain doing its best to keep the new content from sticking.

If you answer ‘yes’ to all of these, this book is for you

  • Do you already know how to program in another programming language?
  • Do you wish you had the know-how to program Python, add it to your list of tools, and make it do new things?
  • Do you prefer actually doing things and applying the stuff you learn over listening to someone in a lecture rattle on for hours on end?
Here’s what we do:

We use pictures, because your brain is tuned for visuals, not text. As far as your brain’s concerned, a picture really is worth a thousand words. And when text and pictures work together, we embedded the text in the pictures because your brain works more effectively when the text is within the thing the text refers to, as opposed to in a caption or buried in the text somewhere.

We use redundancy, saying the same thing in different ways and with different media types, and multiple senses, to increase the chance that the content gets coded into more than one area of your brain.

We use concepts and pictures in unexpected ways because your brain is tuned for novelty, and we use pictures and ideas with at least some emotional content, because your brain is more likely to remember when you feel something.

We use a personalized, conversational style, because your brain is tuned to pay more attention when it believes you’re in a conversation than if it thinks you’re passively listening to a presentation.

We include many activities, because your brain is tuned to learn and remember more when you do things than when you read about things. And we make the exercises challenging-yet-do-able, because that’s what most people prefer.

We use multiple learning styles, because you might prefer step-by-step procedures, while someone else wants to understand the big picture first, and someone else just wants to see an example. But regardless of your own learning preference, everyone benefits from seeing the same content represented in multiple ways.

We include content for both sides of your brain, because the more of your brain you engage, the more likely you are to learn and remember, and the longer you can stay focused. Since working one side of the brain often means giving the other side a chance to rest, you can be more productive at learning for a longer period of time.

We include challenges by asking questions that don’t always have a straight answer, because your brain is tuned to learn and remember when it has to work at something.

Finally, we use people in our stories, examples, and pictures, because, well, you’re a person. Your brain pays more attention to people than to things.

About the Author:

Paul Barry is formally educated and trained in Computer Science and holds a Masters Degree in Computing Science. He has been programming professionally, on and off, for close to 25 years. Paul already has two textbooks to his name, and is also a Contributing Editor to Linux Journal magazine. His day job is with the Institute of Technology, Carlow in Ireland where he has spent over a decade preparing Ireland’s next generation of computing folk to be productive in the workforce. His role as a third level educator affords him the opportunity to explore, learn and teach the very latest programming technologies and practices, which is something that he enjoys even though he knows this makes him a bonafide “geek”. Paul lives just outside the town of Carlow in Ireland with his wife, two sons, daughter, dog and cat. There’s a bunch of computers and a growing collection of music instruments in the house, too (and like a lot of the Head First family, Paul is a struggling guitarist trapped inside a geek’s body). He has so far resisted any suggestion that the family acquire a hamster … or a set of drums.

Book Details:

  • ASIN: B01N0GU0OC
  • ISBN-10: 1491919531
  • ISBN-13: 978-1491919538
  • Publisher: O’Reilly Media; 2nd edition (November 21, 2016)
  • Publication date: November 21, 2016
  • Print length: 983 pages

Table of Contents:

Sources:

Fair Use Sources:

Categories
Bibliography Python Software Engineering

Introducing Python: Modern Computing in Simple Packages, by Bill Lubanovic

See also: Python, Python Bibliography and Bibliography of Python Libraries and Web Frameworks

See: Introducing Python: Modern Computing in Simple Packages, by Bill Lubanovic, 2020, B0815R5543 (IPyBLub)

Fair Use Source: B0815R5543 (IPyBLub)

About This Book:

Easy to understand and fun to read, this updated edition of Introducing Python is ideal for beginning programmers as well as those new to the language. Author Bill Lubanovic takes you from the basics to more involved and varied topics, mixing tutorials with cookbook-style code recipes to explain concepts in Python 3. End-of-chapter exercises help you practice what you’ve learned.

You’ll gain a strong foundation in the language, including best practices for testing, debugging, code reuse, and other development tips. This book also shows you how to use Python for applications in business, science, and the arts, using various Python tools and open source packages.

About the Author:

Bill Lubanovic has developed software with UNIX since 1977, GUIs since 1981, databases since 1990, and the Web since 1993. Recently, he developed core services and distributed systems with a remote team for a Manhattan startup. Currently, he’s integrating OpenStack services for a supercomputer company.

Book Details:

  • ASIN: B0815R5543
  • ISBN-10: 1492051365
  • ISBN-13: 978-1492051367
  • Publisher: O’Reilly Media; 2nd edition (November 6, 2019)
  • Publication date: November 6, 2019
  • Print length: 960 pages

Table of Contents:

Preface Audience

Changes in the Second Edition

Outline

Python Versions

Conventions Used in This Book

Using Code Examples

O’Reilly Online Learning

How to Contact Us

Acknowledgments

I. Python Basics

  1. A Taste of Py Mysteries

Little Programs

A Bigger Program

Python in the Real World

Python Versus the Language from Planet X

Why Python?

Why Not Python?

Python 2 Versus Python 3

Installing Python

Running Python Using the Interactive Interpreter

Using Python Files

What’s Next?

Your Moment of Zen

Coming Up

Things to Do

  1. Data: Types, Values, Variables, and Names Python Data Are Objects

Types

Mutability

Literal Values

Variables

Assignment

Variables Are Names, Not Places

Assigning to Multiple Names

Reassigning a Name

Copying

Choose Good Variable Names

Coming Up

Things to Do

  1. Numbers Booleans

Integers Literal Integers

Integer Operations

Integers and Variables

Precedence

Bases

Type Conversions

How Big Is an int?

Floats

Math Functions

Coming Up

Things to Do

  1. Choose with if Comment with #

Continue Lines with \

Compare with if, elif, and else

What Is True?

Do Multiple Comparisons with in

New: I Am the Walrus

Coming Up

Things to Do

  1. Text Strings Create with Quotes

Create with str()

Escape with \

Combine by Using +

Duplicate with *

Get a Character with []

Get a Substring with a Slice

Get Length with len()

Split with split()

Combine by Using join()

Substitute by Using replace()

Strip with strip()

Search and Select

Case

Alignment

Formatting Old style: %

New style: {} and format()

Newest Style: f-strings

More String Things

Coming Up

Things to Do

  1. Loop with while and for Repeat with while Cancel with break

Skip Ahead with continue

Check break Use with else

Iterate with for and in Cancel with break

Skip with continue

Check break Use with else

Generate Number Sequences with range()

Other Iterators

Coming Up

Things to Do

  1. Tuples and Lists Tuples Create with Commas and ()

Create with tuple()

Combine Tuples by Using +

Duplicate Items with *

Compare Tuples

Iterate with for and in

Modify a Tuple

Lists Create with []

Create or Convert with list()

Create from a String with split()

Get an Item by [ offset ]

Get Items with a Slice

Add an Item to the End with append()

Add an Item by Offset with insert()

Duplicate All Items with *

Combine Lists by Using extend() or +

Change an Item by [ offset ]

Change Items with a Slice

Delete an Item by Offset with del

Delete an Item by Value with remove()

Get an Item by Offset and Delete It with pop()

Delete All Items with clear()

Find an Item’s Offset by Value with index()

Test for a Value with in

Count Occurrences of a Value with count()

Convert a List to a String with join()

Reorder Items with sort() or sorted()

Get Length with len()

Assign with =

Copy with copy(), list(), or a Slice

Copy Everything with deepcopy()

Compare Lists

Iterate with for and in

Iterate Multiple Sequences with zip()

Create a List with a Comprehension

Lists of Lists

Tuples Versus Lists

There Are No Tuple Comprehensions

Coming Up

Things to Do

  1. Dictionaries and Sets Dictionaries Create with {}

Create with dict()

Convert with dict()

Add or Change an Item by [ key ]

Get an Item by [key] or with get()

Get All Keys with keys()

Get All Values with values()

Get All Key-Value Pairs with items()

Get Length with len()

Combine Dictionaries with {**a, **b}

Combine Dictionaries with update()

Delete an Item by Key with del

Get an Item by Key and Delete It with pop()

Delete All Items with clear()

Test for a Key with in

Assign with =

Copy with copy()

Copy Everything with deepcopy()

Compare Dictionaries

Iterate with for and in

Dictionary Comprehensions

Sets Create with set()

Convert with set()

Get Length with len()

Add an Item with add()

Delete an Item with remove()

Iterate with for and in

Test for a Value with in

Combinations and Operators

Set Comprehensions

Create an Immutable Set with frozenset()

Data Structures So Far

Make Bigger Data Structures

Coming Up

Things to Do

  1. Functions Define a Function with def

Call a Function with Parentheses

Arguments and Parameters None Is Useful

Positional Arguments

Keyword Arguments

Specify Default Parameter Values

Explode/Gather Positional Arguments with *

Explode/Gather Keyword Arguments with **

Keyword-Only Arguments

Mutable and Immutable Arguments

Docstrings

Functions Are First-Class Citizens

Inner Functions Closures

Anonymous Functions: lambda

Generators Generator Functions

Generator Comprehensions

Decorators

Namespaces and Scope

Uses of _ and __ in Names

Recursion

Async Functions

Exceptions Handle Errors with try and except

Make Your Own Exceptions

Coming Up

Things to Do

  1. Oh Oh: Objects and Classes What Are Objects?

Simple Objects Define a Class with class

Attributes

Methods

Initialization

Inheritance Inherit from a Parent Class

Override a Method

Add a Method

Get Help from Your Parent with super()

Multiple Inheritance

Mixins

In self Defense

Attribute Access Direct Access

Getters and Setters

Properties for Attribute Access

Properties for Computed Values

Name Mangling for Privacy

Class and Object Attributes

Method Types Instance Methods

Class Methods

Static Methods

Duck Typing

Magic Methods

Aggregation and Composition

When to Use Objects or Something Else

Named Tuples

Dataclasses

Attrs

Coming Up

Things to Do

  1. Modules, Packages, and Goodies Modules and the import Statement Import a Module

Import a Module with Another Name

Import Only What You Want from a Module

Packages The Module Search Path

Relative and Absolute Imports

Namespace Packages

Modules Versus Objects

Goodies in the Python Standard Library Handle Missing Keys with setdefault() and defaultdict()

Count Items with Counter()

Order by Key with OrderedDict()

Stack + Queue == deque

Iterate over Code Structures with itertools

Print Nicely with pprint()

Get Random

More Batteries: Get Other Python Code

Coming Up

Things to Do

II. Python in Practice

  1. Wrangle and Mangle Data Text Strings: Unicode Python 3 Unicode Strings

UTF-8

Encode

Decode

HTML Entities

Normalization

For More Information

Text Strings: Regular Expressions Find Exact Beginning Match with match()

Find First Match with search()

Find All Matches with findall()

Split at Matches with split()

Replace at Matches with sub()

Patterns: Special Characters

Patterns: Using Specifiers

Patterns: Specifying match() Output

Binary Data bytes and bytearray

Convert Binary Data with struct

Other Binary Data Tools

Convert Bytes/Strings with binascii()

Bit Operators

A Jewelry Analogy

Coming Up

Things to Do

  1. Calendars and Clocks Leap Year

The datetime Module

Using the time Module

Read and Write Dates and Times

All the Conversions

Alternative Modules

Coming Up

Things to Do

  1. Files and Directories File Input and Output Create or Open with open()

Write a Text File with print()

Write a Text File with write()

Read a Text File with read(), readline(), or readlines()

Write a Binary File with write()

Read a Binary File with read()

Close Files Automatically by Using with

Change Position with seek()

Memory Mapping

File Operations Check Existence with exists()

Check Type with isfile()

Copy with copy()

Change Name with rename()

Link with link() or symlink()

Change Permissions with chmod()

Change Ownership with chown()

Delete a File with remove()

Directory Operations Create with mkdir()

Delete with rmdir()

List Contents with listdir()

Change Current Directory with chdir()

List Matching Files with glob()

Pathnames Get a Pathname with abspath()

Get a symlink Pathname with realpath()

Build a Pathname with os.path.join()

Use pathlib

BytesIO and StringIO

Coming Up

Things to Do

  1. Data in Time: Processes and Concurrency Programs and Processes Create a Process with subprocess

Create a Process with multiprocessing

Kill a Process with terminate()

Get System Info with os

Get Process Info with psutil

Command Automation Invoke

Other Command Helpers

Concurrency Queues

Processes

Threads

concurrent.futures

Green Threads and gevent

twisted

asyncio

Redis

Beyond Queues

Coming Up

Things to Do

  1. Data in a Box: Persistent Storage Flat Text Files

Padded Text Files

Tabular Text Files CSV

XML

An XML Security Note

HTML

JSON

YAML

Tablib

Pandas

Configuration Files

Binary Files Padded Binary Files and Memory Mapping

Spreadsheets

HDF5

TileDB

Relational Databases SQL

DB-API

SQLite

MySQL

PostgreSQL

SQLAlchemy

Other Database Access Packages

NoSQL Data Stores The dbm Family

Memcached

Redis

Document Databases

Time Series Databases

Graph Databases

Other NoSQL

Full-Text Databases

Coming Up

Things to Do

  1. Data in Space: Networks TCP/IP Sockets

Scapy

Netcat

Networking Patterns

The Request-Reply Pattern ZeroMQ

Other Messaging Tools

The Publish-Subscribe Pattern Redis

ZeroMQ

Other Pub-Sub Tools

Internet Services Domain Name System

Python Email Modules

Other Protocols

Web Services and APIs

Data Serialization Serialize with pickle

Other Serialization Formats

Remote Procedure Calls XML RPC

JSON RPC

MessagePack RPC

Zerorpc

gRPC

Twirp

Remote Management Tools

Big Fat Data Hadoop

Spark

Disco

Dask

Clouds Amazon Web Services

Google Cloud

Microsoft Azure

OpenStack

Docker Kubernetes

Coming Up

Things to Do

  1. The Web, Untangled Web Clients Test with telnet

Test with curl

Test with httpie

Test with httpbin

Python’s Standard Web Libraries

Beyond the Standard Library: requests

Web Servers The Simplest Python Web Server

Web Server Gateway Interface (WSGI)

ASGI

Apache

NGINX

Other Python Web Servers

Web Server Frameworks Bottle

Flask

Django

Other Frameworks

Database Frameworks

Web Services and Automation webbrowser

webview

Web APIs and REST

Crawl and Scrape Scrapy

BeautifulSoup

Requests-HTML

Let’s Watch a Movie

Coming Up

Things to Do

  1. Be a Pythonista About Programming

Find Python Code

Install Packages Use pip

Use virtualenv

Use pipenv

Use a Package Manager

Install from Source

Integrated Development Environments IDLE

PyCharm

IPython

Jupyter Notebook

JupyterLab

Name and Document

Add Type Hints

Test Check with pylint, pyflakes, flake8, or pep8

Test with unittest

Test with doctest

Test with nose

Other Test Frameworks

Continuous Integration

Debug Python Code Use print()

Use Decorators

Use pdb

Use breakpoint()

Log Error Messages

Optimize Measure Timing

Algorithms and Data Structures

Cython, NumPy, and C Extensions

PyPy

Numba

Source Control Mercurial

Git

Distribute Your Programs

Clone This Book

How You Can Learn More Books

Websites

Groups

Conferences

Getting a Python Job

Coming Up

Things to Do

  1. Py Art 2-D Graphics Standard Library

PIL and Pillow

ImageMagick

3-D Graphics

3-D Animation

Graphical User Interfaces

Plots, Graphs, and Visualization Matplotlib

Seaborn

Bokeh

Games

Audio and Music

Coming Up

Things to Do

  1. Py at Work The Microsoft Office Suite

Carrying Out Business Tasks

Processing Business Data Extracting, Transforming, and Loading

Data Validation

Additional Sources of Information

Open Source Python Business Packages

Python in Finance

Business Data Security

Maps Formats

Draw a Map from a Shapefile

Geopandas

Other Mapping Packages

Applications and Data

Coming Up

Things to Do

  1. Py Sci Math and Statistics in the Standard Library Math Functions

Working with Complex Numbers

Calculate Accurate Floating Point with decimal

Perform Rational Arithmetic with fractions

Use Packed Sequences with array

Handling Simple Stats with statistics

Matrix Multiplication

Scientific Python

NumPy Make an Array with array()

Make an Array with arange()

Make an Array with zeros(), ones(), or random()

Change an Array’s Shape with reshape()

Get an Element with []

Array Math

Linear Algebra

SciPy

SciKit

Pandas

Python and Scientific Areas

Coming Up

Things to Do

A. Hardware and Software for Beginning Programmers Hardware Caveman Computers

Electricity

Inventions

An Idealized Computer

The CPU

Memory and Caches

Storage

Inputs

Outputs

Relative Access Times

Software In the Beginning Was the Bit

Machine Language

Assembler

Higher-Level Languages

Operating Systems

Virtual Machines

Containers

Distributed Computing and Networks

The Cloud

Kubernetes

B. Install Python 3 Check Your Python Version

Install Standard Python macOS

Windows

Linux or Unix

Install the pip Package Manager

Install virtualenv

Other Packaging Solutions

Install Anaconda Install Anaconda’s Package Manager conda

C. Something Completely Different: Async Coroutines and Event Loops

Asyncio Alternatives

Async Versus…

Async Frameworks and Servers

D. Answers to Exercises 1. A Taste of Py

  1. Data: Types, Values, Variables, and Names
  2. Numbers
  3. Choose with if
  4. Text Strings
  5. Loop with while and for
  6. Tuples and Lists
  7. Dictionaries
  8. Functions
  9. Oh Oh: Objects and Classes
  10. Modules, Packages, and Goodies
  11. Wrangle and Mangle Data
  12. Calendars and Clocks
  13. Files and Directories
  14. Data in Time: Processes and Concurrency
  15. Data in a Box: Persistent Storage
  16. Data in Space: Networks
  17. The Web, Untangled
  18. Be a Pythonista
  19. Py Art
  20. Py at Work
  21. PySci

E. Cheat Sheets Operator Precedence

String Methods Change Case

Search

Modify

Format

String Type

String Module Attributes

Coda

Index

Preface:

“As the title promises, this book will introduce you to one of the world’s most popular programming languages: Python. It’s aimed at beginning programmers as well as more experienced programmers who want to add Python to the languages they already know.” (IPyBLub)

“In most cases, it’s easier to learn a computer language than a human language. There’s less ambiguity and fewer exceptions to keep in your head. Python is one of the most consistent and clear computer languages. It balances ease of learning, ease of use, and expressive power.” (IPyBLub)

“Computer languages are made of data (like nouns in spoken languages) and instructions or code (like verbs). You need both. In alternating chapters, you’ll be introduced to Python’s basic code and data structures, learn how to combine them, and build up to more advanced ones. The programs that you read and write will get longer and more complex. Using a woodworking analogy, we’ll start with a hammer, nails, and scraps of wood. Over the first half of this book, we’ll introduce more specialized components, up to the equivalents of lathes and other power tools.” (IPyBLub)

“You’ll not only learn the language, but also what to do with it. We’ll begin with the Python language and its “batteries included” standard library, but I’ll also show you how to find, download, install, and use some good third-party packages. My emphasis is on whatever I’ve actually found useful in more than 10 years of production Python development, rather than fringe topics or complex hacks.” (IPyBLub)

“Although this is an introduction, some advanced topics are included because I want to expose them to you. Areas like databases and the web are still covered, but technology changes fast. A Python programmer might now be expected to know something about cloud computing, machine learning, or event streaming. You’ll find something here on all of these.” (IPyBLub)

“Python has some special features that work better than adapting styles from other languages that you may know. For example, using for and iterators is a more direct way of making a loop than manually incrementing some counter variable.” (IPyBLub)

“When you’re learning something new, it’s hard to tell which terms are specific instead of colloquial, and which concepts are actually important. In other words, “Is this on the test?” I’ll highlight terms and ideas that have specific meaning or importance in Python, but not too many at once. Real Python code is included early and often.” (IPyBLub)

Note: “I’ll include a note such as this when something might be confusing, or if there’s a more appropriate Pythonic way to do it.” (IPyBLub)

“Python isn’t perfect. I’ll show you things that seem odd or that should be avoided — and offer alternatives you can use, instead.” (IPyBLub)

“Now and then, my opinions on some subjects (such as object inheritance, or MVC and REST designs for the web) may vary a bit from the common wisdom. See what you think.” (IPyBLub)

Audience:

“This book is for anybody interested in learning one of the world’s most popular computing languages, regardless of whether you have previously learned any programming.” (IPyBLub)

Changes in the Second Edition:

“What’s changed since the first edition?

About a hundred more pages, including cat pictures.

Twice the chapters, each shorter now.

An early chapter devoted to data types, variables, and names.

New standard Python features like f-strings.

New or improved third-party packages.

New code examples throughout.

An appendix on basic hardware and software, for new programmers.

An appendix on asyncio, for not-so-new programmers.

“New stack” coverage: containers, clouds, data science, and machine learning.

Hints on getting a job programming in Python.

What hasn’t changed? Examples using bad poetry and ducks. These are evergreen.” (IPyBLub)

Outline:

“Part I (Chapters 1–11) explains Python’s basics. You should read these chapters in order. I work up from the simplest data and code structures, combining them on the way into more detailed and realistic programs. Part II (Chapters 12–22) shows how Python is used in specific application areas such as the web, databases, networks, and so on; read these chapters in any order you like.” (IPyBLub)

“Here’s a brief preview of the chapters and appendixes, including some of the terms that you’ll run into there:” (IPyBLub)

Chapter 1, A Taste of Py

“Computer programs are not that different from directions that you see every day. Some little Python programs give you a glimpse of the language’s looks, capabilities, and uses in the real world. You’ll see how to run a Python program within its interactive interpreter (or shell), or from a text file saved on your computer.” (IPyBLub)

Chapter 2, Data: Types, Values, Variables, and Names

“Computer languages mix data and instructions. Different types of data are stored and treated differently by the computer. They may allow their values to be changed (mutable) or not (immutable). In a Python program, data can be literal (numbers like 78, text strings like “waffle”) or represented by named variables. Python treats variables like names, which is different from many other languages and has some important consequences.” (IPyBLub)

Chapter 3, Numbers

“This chapter shows Python’s simplest data types: booleans, integers, and floating-point numbers. You’ll also learn the basic math operations. The examples use Python’s interactive interpreter like a calculator.” (IPyBLub)

Chapter 4, Choose with if

“We’ll bounce between Python’s nouns (data types) and verbs (program structures) for a few chapters. Python code normally runs a line at a time, from the start to the end of a program. The if code structure lets you run different lines of code, depending on some data comparison.” (IPyBLub)

Chapter 5, Text Strings

“Back to nouns, and the world of text strings. Learn how to create, combine, change, retrieve, and print strings.” (IPyBLub)

Chapter 6, Loop with while and for

“Verbs again, and two ways to make a loop: for and while. You’ll be introduced to a core Python concept: iterators.” (IPyBLub)

Chapter 7, Tuples and Lists

“It’s time for the first of Python’s higher-level built-in data structures: lists and tuples. These are sequences of values, like LEGO for building much more complex data structures. Step through them with iterators, and build lists quickly with comprehensions.” (IPyBLub)

Chapter 8, Dictionaries and Sets

“Dictionaries (aka dicts) and sets let you save data by their values rather than their position. This turns out to be very handy and will be among your favorite Python features.” (IPyBLub)

Chapter 9, Functions

“Weave the data and code structures of the previous chapters to compare, choose, or repeat. Package code in functions and handle errors with exceptions.” (IPyBLub)

Chapter 10, Oh Oh: Objects and Classes

“The word object is a bit fuzzy, but important in many computer languages, including Python. If you’ve done object-oriented programming in other languages, Python is a bit more relaxed. This chapter explains how to use objects and classes, and when it’s better to use alternatives.” (IPyBLub)

Chapter 11, Modules, Packages, and Goodies

“This chapter demonstrates how to scale out to larger code structures: modules, packages, and programs. You’ll see where to put code and data, how to get data in and out, handle options, tour the Python Standard Library, and take a glance at what lies beyond.” (IPyBLub)

Chapter 12, Wrangle and Mangle Data

“Learn to manage (or mangle) data like a pro. This chapter is all about text and binary data, joy with Unicode characters, and regex text searching. It also introduces the data types bytes and bytearray, counterparts of strings that contain raw binary values instead of text characters.” (IPyBLub)

Chapter 13, Calendars and Clocks

“Dates and times can be messy to handle. This chapter shows common problems and useful solutions.” (IPyBLub)

Chapter 14, Files and Directories

“Basic data storage uses files and directories. This chapter shows you how to create and use them.” (IPyBLub)

Chapter 15, Data in Time: Processes and Concurrency

“This is the first hard-core system chapter. Its theme is data in time — how to use programs, processes, and threads to do more things at a time (concurrency). Python’s recent async additions are mentioned, with details in Appendix C.” (IPyBLub)

Chapter 16, Data in a Box: Persistent Storage

“Data can be stored and retrieved with basic flat files and directories within filesystems. They gain some structure with common text formats such as CSV, JSON, and XML. As data get larger and more complex, they need the services of databases — traditional relational ones, and some newer NoSQL data stores.” (IPyBLub)

Chapter 17, Data in Space: Networks

“Send your code and data through space in networks with services, protocols, and APIs. Examples range from low-level TCP sockets, to messaging libraries and queuing systems, to cloud deployment.” (IPyBLub)

Chapter 18, The Web, Untangled

“The web gets its own chapter — clients, servers, APIs, and frameworks. You’ll crawl and scrape websites, and then build real websites with request parameters and templates.” (IPyBLub)

Chapter 19, Be a Pythonista

“This chapter contains tips for Python developers — installation with pip and virtualenv, using IDEs, testing, debugging, logging, source control, and documentation. It also helps you to find and install useful third-party packages, package your own code for reuse, and learn where to get more information.” (IPyBLub)

Chapter 20, Py Art

“People are doing cool things with Python in the arts: graphics, music, animation, and games.” (IPyBLub)

Chapter 21, Py at Work

“Python has specific applications for business: data visualization (plots, graphs, and maps), security, and regulation.” (IPyBLub)

Chapter 22, Py Sci

“In the past few years, Python has emerged as a top language for science: math and statistics, physical science, bioscience, and medicine. Data science and machine learning are notable strengths. This chapter touches on NumPy, SciPy, and Pandas.” (IPyBLub)

Appendix A, Hardware and Software for Beginning Programmers

“If you’re fairly new to programming, this describes how hardware and software actually work. It introduces some terms that you’ll keep running into.” (IPyBLub)

Appendix B, Install Python 3

“If you don’t already have Python 3 on your computer, this appendix shows you how to install it, whether you’re running Windows, macOS, Linux, or some other variant of Unix.” (IPyBLub)

Appendix C, Something Completely Different: Async

“Python has been adding asynchronous features in different releases, and they’re not easy to understand. I mention them as they come up in various chapters, but save a detailed discussion for this appendix.” (IPyBLub)

Appendix D, Answers to Exercises

“This has the answers to the end-of-chapter exercises. Don’t peek here until you’ve tried the exercises yourself, or you might be turned into a newt.” (IPyBLub)

Appendix E, Cheat Sheets

“This appendix contains cheat sheets to use as a quick reference.” (IPyBLub)

Sources:

Fair Use Sources:

Categories
Bibliography Python Software Engineering

Python Programming Courses

See also: Python, Python Bibliography and Bibliography of Python Libraries and Web Frameworks

These are my favorites:

  1. 100 Days of Code – The Complete Python Pro Bootcamp by Dr. Angela Yu (100PyAYu)

Sources:

Fair Use Sources:

  • Udemy, Pluralsight, LinkedIn Learning, A Cloud Guru (Linux Academy), Coursera,
Categories
Bibliography Python Software Engineering

Python Crash Course: A Hands-On, Project-Based Introduction to Programming

See also: Python, Python Bibliography and Bibliography of Python Libraries and Web Frameworks

See: Python Crash Course: A Hands-On, Project-Based Introduction to Programming, by Eric Matthes, B07J4521M3 (PyCrCs)

Fair Use Source: B07J4521M3 (PyCrCs)

About This Book:

Second edition of the best-selling Python book in the world. A fast-paced, no-nonsense guide to programming in Python. Updated and thoroughly revised to reflect the latest in Python code and practices.

Python Crash Course is the world’s best-selling guide to the Python programming language. This fast-paced, thorough introduction to programming with Python will have you writing programs, solving problems, and making things that work in no time.

In the first half of the book, you’ll learn basic programming concepts, such as variables, lists, classes, and loops, and practice writing clean code with exercises for each topic. You’ll also learn how to make your programs interactive and test your code safely before adding it to a project. In the second half, you’ll put your new knowledge into practice with three substantial projects: a Space Invaders-inspired arcade game, a set of data visualizations with Python’s handy libraries, and a simple web app you can deploy online.

As you work through the book, you’ll learn how to:
  Use powerful Python libraries and tools, including Pygame, Matplotlib, Plotly, and Django
  Make 2D games that respond to keypresses and mouse clicks, and that increase in difficulty
  Use data to generate interactive visualizations
  Create and customize web apps and deploy them safely online
  Deal with mistakes and errors so you can solve your own programming problems

If you’ve been thinking about digging into programming, Python Crash Course will get you writing real programs fast. Why wait any longer? Start your engines and code!

About the Author:

Eric Matthes is a high school math and science teacher living in Alaska who teaches an Introduction to Programming class in Python. He has been writing programs since he was five years old.

Reviews:

Python Crash Course selected as one of the best books for learning Python by Real Python

Python Crash Course was selected as one of the best books for learning Python by Real Python
“It has been interesting to see, over the last few years, No Starch Press, which produces this book, growing and producing future classics that should be alongside the more traditional O’Reilly Press programming books. Python Crash Course is one of those books.” —Greg Laden, ScienceBlogs

“All of these projects are well thought out and presented in such a way that learning the subject matter and implementing it is much more an enjoyable pastime rather than an onerous task that must be completed. Eric took the time to deal with some rather complex projects and lay them out in a consistent, logical and pleasant manner that draws the reader into the subject willingly, which unfortunately, many authors fail to do.” —Full Circle Magazine

“The book is well presented with good explanations of the code snippets. It works with you, one small step at a time, building more complex code, explaining what’s going on all the way.” —FlickThrough Reviews

“Learning Python with Python Crash Course was an extremely positive experience! A great choice if you’re new to Python.” —Mikke Goes Coding

Book Details:

  • ASIN: B07J4521M3
  • ISBN-10: 1593279280
  • ISBN-13: 978-1593279288
  • Publisher: No Starch Press; 2nd edition (May 21, 2019)
  • Publication date: May 21, 2019
  • Print length: 544 pages

Table of Contents:

Sources:

Fair Use Sources:

Categories
Bibliography Python Software Engineering

The Quick Python Book

See also: Python, Python Bibliography and Bibliography of Python Libraries and Web Frameworks

The Quick Python Book by N. Ceder, 1617294039 (QPB)

Fair Use Source: 1617294039 (QPB)

About This Book:

This third revision of Manning’s popular The Quick Python Book offers a clear, crisp updated introduction to the elegant Python programming language and its famously easy-to-read syntax. Written for programmers new to Python, this latest edition includes new exercises throughout. It covers features common to other languages concisely, while introducing Python’s comprehensive standard functions library and unique features in detail.

Foreword by Nicholas Tollervey, Python Software Foundation.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the Technology

Initially Guido van Rossum’s 1989 holiday project, Python has grown into an amazing computer language. It’s a joy to learn and read, and powerful enough to handle everything from low-level system resources to advanced applications like deep learning. Elegantly simple and complete, it also boasts a massive ecosystem of libraries and frameworks. Python programmers are in high demand/mdash;you can’t afford not to be fluent!

About the Book

The Quick Python Book, Third Edition is a comprehensive guide to the Python language by a Python authority, Naomi Ceder. With the personal touch of a skilled teacher, she beautifully balances details of the language with the insights and advice you need to handle any task. Extensive, relevant examples and learn-by-doing exercises help you master each important concept the first time through. Whether you’re scraping websites or playing around with nested tuples, you’ll appreciate this book’s clarity, focus, and attention to detail.

What’s Inside

  • Clear coverage of Python 3
  • Core libraries, packages, and tools
  • In-depth exercises
  • Five new data science-related chapters

About the Reader

Written for readers familiar with programming concepts–no Python experience assumed.

About the Author

About the Author:

Naomi Ceder was chair of the Python Software Foundation, has been learning, using, and teaching Python since 2001, and is the Open Source Development Manager at Dick Blick Art Materials.

Reviews:

“Naomi’s book epitomizes what it is to be Pythonic: beautiful is better than ugly, simple is better than complex, and readability counts.” –From the Foreword by Nicholas Tollervey, Python Software Foundation

“Leads you from a basic knowledge of Python to its most interesting features, always using accessible language.” –Eros Pedrini, everis

“Unleash your Pythonic powers with this book and start coding real-world applications fast.”–Carlos Fernández Manzano, Aguas de Murcia 

“The complete and definitive book to start learning Python.” –Christos Paisios, e-Travel

Book Details:

  • ASIN: 1617294039
  • ISBN-10: 1617294039
  • ISBN-13: 978-1617294037
  • Publisher: Manning Publications; 3rd edition (June 14, 2018)
  • Paperback: 472 pages

Table of Contents:

Table of Contents

PART 1 – STARTING OUT
1. About Python
2. Getting started
3. The Quick Python overview

PART 2 – THE ESSENTIALS
4. The absolute basics
5. Lists, tuples, and sets
6. Strings
7. Dictionaries
8. Control flow
9. Functions
10. Modules and scoping rules
11. Python programs
12. Using the filesystem
13. Reading and writing files
14. Exceptions

PART 3 – ADVANCED LANGUAGE FEATURES
15. Classes and object-oriented programming
16. Regular expressions
17. Data types as objects
18. Packages
19. Using Python libraries

PART 4 – WORKING WITH DATA
20. Basic file wrangling
21. Processing data files
22. Data over the network
23. Saving data
24. Exploring data

Sources:

Fair Use Sources:

Categories
Bibliography Python Software Engineering

Think Python: How to Think Like a Computer Scientist

See also: Python, Python Bibliography and Bibliography of Python Libraries and Web Frameworks

Think Python: How to Think Like a Computer Scientist, by Allen B. Downey, B018UXJ9EQ (ThnkPy)

Fair Use Source: B018UXJ9EQ (ThnkPy)

About This Book:

If you want to learn how to program, working with Python is an excellent way to start. This hands-on guide takes you through the language a step at a time, beginning with basic programming concepts before moving on to functions, recursion, data structures, and object-oriented design. This second edition and its supporting code have been updated for Python 3.

Through exercises in each chapter, you’ll try out programming concepts as you learn them. Think Python is ideal for students at the high school or college level, as well as self-learners, home-schooled students, and professionals who need to learn programming basics. Beginners just getting their feet wet will learn how to start with Python in a browser.

  • Start with the basics, including language syntax and semantics
  • Get a clear definition of each programming concept
  • Learn about values, variables, statements, functions, and data structures in a logical progression
  • Discover how to work with files and databases
  • Understand objects, methods, and object-oriented programming
  • Use debugging techniques to fix syntax, runtime, and semantic errors
  • Explore interface design, data structures, and GUI-based programs through case studies

About the Author:

Allen Downey is a Professor of Computer Science at Olin College of Engineering. He has taught at Wellesley College, Colby College and U.C. Berkeley. He has a Ph.D. in Computer Science from U.C. Berkeley and Master’s and Bachelor’s degrees from MIT.

Book Details:

  • ASIN: B018UXJ9EQ
  • Publisher: O’Reilly Media; 2nd edition (December 2, 2015)
  • Publication date: December 2, 2015
  • Print length: 452 pages

Table of Contents:

Sources:

Fair Use Sources:

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:

Categories
Bibliography Python Software Engineering

Programming Python: Powerful Object-Oriented Programming, by Mark Lutz

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

See: Programming Python: Powerful Object-Oriented Programming, by Mark Lutz, B004GTLFJ6 (PPMkLz)

Fair Use Source: B004GTLFJ6 (PPMkLz)

About This Book:

If you’ve mastered Python’s fundamentals, you’re ready to start using it to get real work done. Programming Python will show you how, with in-depth tutorials on the language’s primary application domains: system administration, GUIs, and the Web. You’ll also explore how Python is used in databases, networking, front-end scripting layers, text processing, and more. This book focuses on commonly used tools and libraries to give you a comprehensive understanding of Python’s many roles in practical, real-world programming.

You’ll learn language syntax and programming techniques in a clear and concise manner, with lots of examples that illustrate both correct usage and common idioms. Completely updated for version 3.x, Programming Python also delves into the language as a software development tool, with many code examples scaled specifically for that purpose.

Topics include:

  • Quick Python tour: Build a simple demo that includes data representation, object-oriented programming, object persistence, GUIs, and website basics
  • System programming: Explore system interface tools and techniques for command-line scripting, processing files and folders, running programs in parallel, and more
  • GUI programming: Learn to use Python’s tkinter widget library
  • Internet programming: Access client-side network protocols and email tools, use CGI scripts, and learn website implementation techniques
  • More ways to apply Python: Implement data structures, parse text-based information, interface with databases, and extend and embed Python

About the Author:

Mark Lutz is the world leader in Python training, the author of Python’s earliest and best-selling texts, and a pioneering figure in the Python community since 1992. He has been a software developer for 25 years. Mark is the author of the three O’Reilly books: Learning PythonProgramming Python, and Python Pocket Reference, all currently in fourth or fifth editions.

Book Details:

  • ASIN: B004GTLFJ6
  • ISBN-10: 0596158106
  • ISBN-13: 978-0596158101
  • Publisher: O’Reilly Media; 4th edition (December 14, 2010)
  • Publication date: December 14, 2010
  • Print length : 2654 pages

Table of Contents:

Sources:

Fair Use Sources:

Categories
Bibliography Python Software Engineering

Learning Python: Powerful Object-Oriented Programming, 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, Python Pocket Reference by Mark Lutz

Learning Python: Powerful Object-Oriented Programming, by Mark Lutz, B00DDZPC9S (LPMkLz)

Fair Use Source: B00DDZPC9S (LPMkLz)

About This Book:

Get a comprehensive, in-depth introduction to the core Python language with this hands-on book. Based on author Mark Lutz’s popular training course, this updated fifth edition will help you quickly write efficient, high-quality code with Python. It’s an ideal way to begin, whether you’re new to programming or a professional developer versed in other languages.

Complete with quizzes, exercises, and helpful illustrations, this easy-to-follow, self-paced tutorial gets you started with both Python 2.7 and 3.3— the latest releases in the 3.X and 2.X lines—plus all other releases in common use today. You’ll also learn some advanced language features that recently have become more common in Python code.

  • Explore Python’s major built-in object types such as numbers, lists, and dictionaries
  • Create and process objects with Python statements, and learn Python’s general syntax model
  • Use functions to avoid code redundancy and package code for reuse
  • Organize statements, functions, and other tools into larger components with modules
  • Dive into classes: Python’s object-oriented programming tool for structuring code
  • Write large programs with Python’s exception-handling model and development tools
  • Learn advanced Python tools, including decorators, descriptors, metaclasses, and Unicode processing

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: B00DDZPC9S
  • ISBN-10: 1449355730
  • ISBN-13: 978-1449355739
  • Publisher: O’Reilly Media; 5th edition (June 12, 2013)
  • Publication date: June 12, 2013
  • Print length: 1650 pages

Table of Contents:

Sources:

Fair Use Sources:

Categories
Bibliography Data Science - Big Data DevOps Python Software Engineering

Python Bibliography

See also: Python and Bibliography of Python Libraries and Web Frameworks, Python Programming Courses

  1. Python Software Foundation Documentation (PSFDoc)
  2. GitHub (GH)
  3. Wikipedia (WP)
  4. 100 Days of Code – The Complete Python Pro Bootcamp, by Dr. Angela Yu (100PyAYu)
  5. The Python 3 Standard Library by Example, by Doug Hellmann, B072QZZDV7 (P3SLbE)
  6. Python Pocket Reference: Python In Your Pocket, by Mark Lutz, B00HZ41PGC (PPR)
  7. Head First Python: A Brain-Friendly Guide, by Paul Barry, B01N0GU0OC (HFPy)
  8. The Well-Grounded Python Developer, by Doug Farrell, 2021, 1617297441 (WlGrPD)
  9. Learning Python: Powerful Object-Oriented Programming, by Mark Lutz, B00DDZPC9S (LPMkLz)
  10. Programming Python: Powerful Object-Oriented Programming, by Mark Lutz, B004GTLFJ6 (PPMkLz)
  11. Python Crash Course: A Hands-On, Project-Based Introduction to Programming, by Eric Matthes, B07J4521M3 (PyCrCs)
  12. Introducing Python: Modern Computing in Simple Packages, by Bill Lubanovic, 2020, B0815R5543 (IPyBLub)
  13. Practices of the Python Pro, by Dane Hillard, 2020, 1617296082 (PrPyPro)
  14. Think Python: How to Think Like a Computer Scientist, by Allen B. Downey, B018UXJ9EQ (ThnkPy)
  15. Python in a Nutshell: A Desktop Quick Reference, 3rd Edition, by Alex Martelli, Anna Ravenscroft, and Steve Holden, 2017, B06Y4DVSBM (PyNutSh)
  16. The Quick Python Book, by N. Ceder, 1617294039 (QPB)

Categories
Cloud Python

The Python 3 Standard Library by Example

See also: Python Bibliography and Python

The Python 3 Standard Library by Example, by Doug Hellmann, B072QZZDV7 (P3SLbE)

Fair Use Source: B072QZZDV7 (P3SLbE)

About This Book:

Master the Powerful Python 3 Standard Library through Real Code Examples 

“The genius of Doug’s approach is that with 15 minutes per week, any motivated programmer can learn the Python Standard Library. Doug’s guided tour will help you flip the switch to fully power-up Python’s batteries.”

–Raymond Hettinger, Distinguished Python Core Developer

 The Python 3 Standard Library contains hundreds of modules for interacting with the operating system, interpreter, and Internet–all extensively tested and ready to jump-start application development. Now, Python expert Doug Hellmann introduces every major area of the Python 3.x library through concise source code and output examples. Hellmann’s examples fully demonstrate each feature and are designed for easy learning and reuse.

You’ll find practical code for working with text, data structures, algorithms, dates/times, math, the file system, persistence, data exchange, compression, archiving, crypto, processes/threads, networking, Internet capabilities, email, developer and language tools, the runtime, packages, and more. Each section fully covers one module, with links to additional resources, making this book an ideal tutorial and reference.

The Python 3 Standard Library by Example introduces Python 3.x’s new libraries, significant functionality changes, and new layout and naming conventions. Hellmann also provides expert porting guidance for moving code from 2.x Python standard library modules to their Python 3.x equivalents.

  • Manipulate text with string, textwrap, re (regular expressions), and difflib
  • Use data structures: enum, collections, array, heapq, queue, struct, copy, and more
  • Implement algorithms elegantly and concisely with functools, itertools, and contextlib
  • Handle dates/times and advanced mathematical tasks
  • Archive and data compression
  • Understand data exchange and persistence, including json, dbm, and sqlite
  • Sign and verify messages cryptographically
  • Manage concurrent operations with processes and threads
  • Test, debug, compile, profile, language, import, and package tools
  • Control interaction at runtime with interpreters or the environment

About the Author:

Doug Hellmann is currently employed by Red Hat to work on OpenStack. He is on the OpenStack Technical Committee and contributes to many aspects of the project. He has been programming in Python since version 1.4, and has worked on a variety of UNIX and non-UNIX platforms for projects in fields such as mapping, medical news publishing, banking, and data center automation. Doug is a Fellow of the Python Software Foundation and served as its Communications Director from 2010-2012. After a year as a regular columnist for Python Magazine, he served as Editor-in-Chief from 2008-2009. Between 2007 and 2011, Doug published the popular “Python Module of the Week” series on his blog, and an earlier version of this book (for Python 2), The Python Standard Library By Example (Addison-Wesley, 2011) . He lives in Athens, Georgia. 

Book Details:

  • ASIN: B072QZZDV7
  • ISBN-13: 978-0-13-429105-5
  • ISBN-10: 0-13-429105-0
  • Publisher: Addison-Wesley Professional; 1st edition (June 14, 2017)
  • Publication date: June 14, 2017
  • Print length: 1456 pages

Table of Contents:

Contents at a Glance

Introduction

Acknowledgments

About the Author

Chapter 1 Text

Chapter 2 Data Structures

Chapter 3 Algorithms

Chapter 4 Dates and Times

Chapter 5 Mathematics

Chapter 6 The File System

Chapter 7 Data Persistence and Exchange

Chapter 8 Data Compression and Archiving

Chapter 9 Cryptography

Chapter 10 Concurrency with Processes, Threads, and Coroutines

Chapter 11 Networking

Chapter 12 The Internet

Chapter 13 Email

Chapter 14 Application Building Blocks

Chapter 15 Internationalization and Localization

Chapter 16 Developer Tools

Chapter 17 Runtime Features

Chapter 18 Language Tools

Chapter 19 Modules and Packages

Appendix A Porting Notes

Appendix B Outside of the Standard Library

Index of Python Modules

Index

Details Contents

Contents

Introduction

Acknowledgments

About the Author

Chapter 1 Text

1.1 string: Text Constants and Templates

1.1.1 Functions

1.1.2 Templates

1.1.3 Advanced Templates

1.1.4 Formatter

1.1.5 Constants

1.2 textwrap: Formatting Text Paragraphs

1.2.1 Example Data

1.2.2 Filling Paragraphs

1.2.3 Removing Existing Indentation

1.2.4 Combining Dedent and Fill

1.2.5 Indenting Blocks

1.2.6 Hanging Indents

1.2.7 Truncating Long Text

1.3 re: Regular Expressions

1.3.1 Finding Patterns in Text

1.3.2 Compiling Expressions

1.3.3 Multiple Matches

1.3.4 Pattern Syntax

1.3.5 Constraining the Search

1.3.6 Dissecting Matches with Groups

1.3.7 Search Options

1.3.8 Looking Ahead or Behind

1.3.9 Self-referencing Expressions

1.3.10 Modifying Strings with Patterns

1.3.11 Splitting with Patterns

1.4 difflib: Compare Sequences

1.4.1 Comparing Bodies of Text

1.4.2 Junk Data

1.4.3 Comparing Arbitrary Types

Chapter 2 Data Structures

2.1 enum: Enumeration Type

2.1.1 Creating Enumerations

2.1.2 Iteration

2.1.3 Comparing Enums

2.1.4 Unique Enumeration Values

2.1.5 Creating Enumerations Programmatically

2.1.6 Non-integer Member Values

2.2 collections: Container Data Types

2.2.1 ChainMap: Search Multiple Dictionaries

2.2.2 Counter: Count Hashable Objects

2.2.3 defaultdict: Missing Keys Return a Default Value

2.2.4 deque: Double-Ended Queue

2.2.5 namedtuple: Tuple Subclass with Named Fields

2.2.6 OrderedDict: Remember the Order Keys Are Added to a Dictionary

2.2.7 collections.abc: Abstract Base Classes for Containers

2.3 array: Sequence of Fixed-Type Data

2.3.1 Initialization

2.3.2 Manipulating Arrays

2.3.3 Arrays and Files

2.3.4 Alternative Byte Ordering

2.4 heapq: Heap Sort Algorithm

2.4.1 Example Data

2.4.2 Creating a Heap

2.4.3 Accessing the Contents of a Heap

2.4.4 Data Extremes from a Heap

2.4.5 Efficiently Merging Sorted Sequences

2.5 bisect: Maintain Lists in Sorted Order

2.5.1 Inserting in Sorted Order

2.5.2 Handling Duplicates

2.6 queue: Thread-Safe FIFO Implementation

2.6.1 Basic FIFO Queue

2.6.2 LIFO Queue

2.6.3 Priority Queue

2.6.4 Building a Threaded Podcast Client

2.7 struct: Binary Data Structures

2.7.1 Functions Versus Struct Class

2.7.2 Packing and Unpacking

2.7.3 Endianness

2.7.4 Buffers

2.8 weakref: Impermanent References to Objects

2.8.1 References

2.8.2 Reference Callbacks

2.8.3 Finalizing Objects

2.8.4 Proxies

2.8.5 Caching Objects

2.9 copy: Duplicate Objects

2.9.1 Shallow Copies

2.9.2 Deep Copies

2.9.3 Customizing Copy Behavior

2.9.4 Recursion in Deep Copy

2.10 pprint: Pretty-Print Data Structures

2.10.1 Printing

2.10.2 Formatting

2.10.3 Arbitrary Classes

2.10.4 Recursion

2.10.5 Limiting Nested Output

2.10.6 Controlling Output Width

Chapter 3 Algorithms

3.1 functools: Tools for Manipulating Functions

3.1.1 Decorators

3.1.2 Comparison

3.1.3 Caching

3.1.4 Reducing a Data Set

3.1.5 Generic Functions

3.2 itertools: Iterator Functions

3.2.1 Merging and Splitting Iterators

3.2.2 Converting Inputs

3.2.3 Producing New Values

3.2.4 Filtering

3.2.5 Grouping Data

3.2.6 Combining Inputs

3.3 operator: Functional Interface to Built-in Operators

3.3.1 Logical Operations

3.3.2 Comparison Operators

3.3.3 Arithmetic Operators

3.3.4 Sequence Operators

3.3.5 In-Place Operators

3.3.6 Attribute and Item “Getters”

3.3.7 Combining Operators and Custom Classes

3.4 contextlib: Context Manager Utilities

3.4.1 Context Manager API

3.4.2 Context Managers as Function Decorators

3.4.3 From Generator to Context Manager

3.4.4 Closing Open Handles

3.4.5 Ignoring Exceptions

3.4.6 Redirecting Output Streams

3.4.7 Dynamic Context Manager Stacks

Chapter 4 Dates and Times

4.1 time: Clock Time

4.1.1 Comparing Clocks

4.1.2 Wall Clock Time

4.1.3 Monotonic Clocks

4.1.4 Processor Clock Time

4.1.5 Performance Counter

4.1.6 Time Components

4.1.7 Working with Time Zones

4.1.8 Parsing and Formatting Times

4.2 datetime: Date and Time Value Manipulation

4.2.1 Times

4.2.2 Dates

4.2.3 timedeltas

4.2.4 Date Arithmetic

4.2.5 Comparing Values

4.2.6 Combining Dates and Times

4.2.7 Formatting and Parsing

4.2.8 Time Zones

4.3 calendar: Work with Dates

4.3.1 Formatting Examples

4.3.2 Locales

4.3.3 Calculating Dates

Chapter 5 Mathematics

5.1 decimal: Fixed- and Floating-Point Math

5.1.1 Decimal

5.1.2 Formatting

5.1.3 Arithmetic

5.1.4 Special Values

5.1.5 Context

5.2 fractions: Rational Numbers

5.2.1 Creating Fraction Instances

5.2.2 Arithmetic

5.2.3 Approximating Values

5.3 random: Pseudorandom Number Generators

5.3.1 Generating Random Numbers

5.3.2 Seeding

5.3.3 Saving State

5.3.4 Random Integers

5.3.5 Picking Random Items

5.3.6 Permutations

5.3.7 Sampling

5.3.8 Multiple Simultaneous Generators

5.3.9 SystemRandom

5.3.10 Non-uniform Distributions

5.4 math: Mathematical Functions

5.4.1 Special Constants

5.4.2 Testing for Exceptional Values

5.4.3 Comparing

5.4.4 Converting Floating-Point Values to Integers

5.4.5 Alternative Representations of Floating-Point Values

5.4.6 Positive and Negative Signs

5.4.7 Commonly Used Calculations

5.4.8 Exponents and Logarithms

5.4.9 Angles

5.4.10 Trigonometry

5.4.11 Hyperbolic Functions

5.4.12 Special Functions

5.5 statistics: Statistical Calculations

5.5.1 Averages

5.5.2 Variance

Chapter 6 The File System

6.1 os.path: Platform-Independent Manipulation of Filenames

6.1.1 Parsing Paths

6.1.2 Building Paths

6.1.3 Normalizing Paths

6.1.4 File Times

6.1.5 Testing Files

6.2 pathlib: File System Paths as Objects

6.2.1 Path Representations

6.2.2 Building Paths

6.2.3 Parsing Paths

6.2.4 Creating Concrete Paths

6.2.5 Directory Contents

6.2.6 Reading and Writing Files

6.2.7 Manipulating Directories and Symbolic Links

6.2.8 File Types

6.2.9 File Properties

6.2.10 Permissions

6.2.11 Deleting

6.3 glob: Filename Pattern Matching

6.3.1 Example Data

6.3.2 Wildcards

6.3.3 Single-Character Wildcard

6.3.4 Character Ranges

6.3.5 Escaping Meta-characters

6.4 fnmatch: Unix-Style Glob Pattern Matching

6.4.1 Simple Matching

6.4.2 Filtering

6.4.3 Translating Patterns

6.5 linecache: Read Text Files Efficiently

6.5.1 Test Data

6.5.2 Reading Specific Lines

6.5.3 Handling Blank Lines

6.5.4 Error Handling

6.5.5 Reading Python Source Files

6.6 tempfile: Temporary File System Objects

6.6.1 Temporary Files

6.6.2 Named Files

6.6.3 Spooled Files

6.6.4 Temporary Directories

6.6.5 Predicting Names

6.6.6 Temporary File Location

6.7 shutil: High-Level File Operations

6.7.1 Copying Files

6.7.2 Copying File Metadata

6.7.3 Working with Directory Trees

6.7.4 Finding Files

6.7.5 Archives

6.7.6 File System Space

6.8 filecmp: Compare Files

6.8.1 Example Data

6.8.2 Comparing Files

6.8.3 Comparing Directories

6.8.4 Using Differences in a Program

6.9 mmap: Memory-Map Files

6.9.1 Reading

6.9.2 Writing

6.9.3 Regular Expressions

6.10 codecs: String Encoding and Decoding

6.10.1 Unicode Primer

6.10.2 Working with Files

6.10.3 Byte Order

6.10.4 Error Handling

6.10.5 Encoding Translation

6.10.6 Non-Unicode Encodings

6.10.7 Incremental Encoding

6.10.8 Unicode Data and Network Communication

6.10.9 Defining a Custom Encoding

6.11 io: Text, Binary, and Raw Stream I/O Tools

6.11.1 In-Memory Streams

6.11.2 Wrapping Byte Streams for Text Data

Chapter 7 Data Persistence and Exchange

7.1 pickle: Object Serialization

7.1.1 Encoding and Decoding Data in Strings

7.1.2 Working with Streams

7.1.3 Problems Reconstructing Objects

7.1.4 Unpicklable Objects

7.1.5 Circular References

7.2 shelve: Persistent Storage of Objects

7.2.1 Creating a New Shelf

7.2.2 Writeback

7.2.3 Specific Shelf Types

7.3 dbm: Unix Key–Value Databases

7.3.1 Database Types

7.3.2 Creating a New Database

7.3.3 Opening an Existing Database

7.3.4 Error Cases

7.4 sqlite3: Embedded Relational Database

7.4.1 Creating a Database

7.4.2 Retrieving Data

7.4.3 Query Metadata

7.4.4 Row Objects

7.4.5 Using Variables with Queries

7.4.6 Bulk Loading

7.4.7 Defining New Column Types

7.4.8 Determining Types for Columns

7.4.9 Transactions

7.4.10 Isolation Levels

7.4.11 In-Memory Databases

7.4.12 Exporting the Contents of a Database

7.4.13 Using Python Functions in SQL

7.4.14 Querying with Regular Expressions

7.4.15 Custom Aggregation

7.4.16 Threading and Connection Sharing

7.4.17 Restricting Access to Data

7.5 xml.etree.ElementTree: XML Manipulation API

7.5.1 Parsing an XML Document

7.5.2 Traversing the Parsed Tree

7.5.3 Finding Nodes in a Document

7.5.4 Parsed Node Attributes

7.5.5 Watching Events While Parsing

7.5.6 Creating a Custom Tree Builder

7.5.7 Parsing Strings

7.5.8 Building Documents With Element Nodes

7.5.9 Pretty-Printing XML

7.5.10 Setting Element Properties

7.5.11 Building Trees from Lists of Nodes

7.5.12 Serializing XML to a Stream

7.6 csv: Comma-Separated Value Files

7.6.1 Reading

7.6.2 Writing

7.6.3 Dialects

7.6.4 Using Field Names

Chapter 8 Data Compression and Archiving

8.1 zlib: GNU zlib Compression

8.1.1 Working with Data in Memory

8.1.2 Incremental Compression and Decompression

8.1.3 Mixed Content Streams

8.1.4 Checksums

8.1.5 Compressing Network Data

8.2 gzip: Read and Write GNU zip Files

8.2.1 Writing Compressed Files

8.2.2 Reading Compressed Data

8.2.3 Working with Streams

8.3 bz2: bzip2 Compression

8.3.1 One-Shot Operations in Memory

8.3.2 Incremental Compression and Decompression

8.3.3 Mixed-Content Streams

8.3.4 Writing Compressed Files

8.3.5 Reading Compressed Files

8.3.6 Reading and Writing Unicode Data

8.3.7 Compressing Network Data

8.4 tarfile: Tar Archive Access

8.4.1 Testing Tar Files

8.4.2 Reading Metadata from an Archive

8.4.3 Extracting Files from an Archive

8.4.4 Creating New Archives

8.4.5 Using Alternative Archive Member Names

8.4.6 Writing Data from Sources Other Than Files

8.4.7 Appending to Archives

8.4.8 Working with Compressed Archives

8.5 zipfile: ZIP Archive Access

8.5.1 Testing ZIP Files

8.5.2 Reading Metadata from an Archive

8.5.3 Extracting Archived Files From an Archive

8.5.4 Creating New Archives

8.5.5 Using Alternative Archive Member Names

8.5.6 Writing Data from Sources Other Than Files

8.5.7 Writing with a ZipInfo Instance

8.5.8 Appending to Files

8.5.9 Python ZIP Archives

8.5.10 Limitations

Chapter 9 Cryptography

9.1 hashlib: Cryptographic Hashing

9.1.1 Hash Algorithms

9.1.2 Sample Data

9.1.3 MD5 Example

9.1.4 SHA1 Example

9.1.5 Creating a Hash by Name

9.1.6 Incremental Updates

9.2 hmac: Cryptographic Message Signing and Verification

9.2.1 Signing Messages

9.2.2 Alternative Digest Types

9.2.3 Binary Digests

9.2.4 Applications of Message Signatures

Chapter 10 Concurrency with Processes, Threads, and Coroutines

10.1 subprocess: Spawning Additional Processes

10.1.1 Running External Command

10.1.2 Working with Pipes Directly

10.1.3 Connecting Segments of a Pipe

10.1.4 Interacting with Another Command

10.1.5 Signaling Between Processes

10.2 signal: Asynchronous System Events

10.2.1 Receiving Signals

10.2.2 Retrieving Registered Handlers

10.2.3 Sending Signals

10.2.4 Alarms

10.2.5 Ignoring Signals

10.2.6 Signals and Threads

10.3 threading: Manage Concurrent Operations Within a Process

10.3.1 Thread Objects

10.3.2 Determining the Current Thread

10.3.3 Daemon Versus Non-daemon Threads

10.3.4 Enumerating All Threads

10.3.5 Subclassing Thread

10.3.6 Timer Threads

10.3.7 Signaling Between Threads

10.3.8 Controlling Access to Resources

10.3.9 Synchronizing Threads

10.3.10 Limiting Concurrent Access to Resources

10.3.11 Thread Specific Data

10.4 multiprocessing: Manage Processes Like Threads

10.4.1 multiprocessing Basics

10.4.2 Importable Target Functions

10.4.3 Determining the Current Process

10.4.4 Daemon Processes

10.4.5 Waiting for Processes

10.4.6 Terminating Processes

10.4.7 Process Exit Status

10.4.8 Logging

10.4.9 Subclassing Process

10.4.10 Passing Messages to Processes

10.4.11 Signaling Between Processes

10.4.12 Controlling Access to Resources

10.4.13 Synchronizing Operations

10.4.14 Controlling Concurrent Access to Resources

10.4.15 Managing Shared State

10.4.16 Shared Namespaces

10.4.17 Process Pools

10.4.18 Implementing MapReduce

10.5 asyncio: Asynchronous I/O, Event Loop, and Concurrency Tools

10.5.1 Asynchronous Concurrency Concepts

10.5.2 Cooperative Multitasking with Coroutines

10.5.3 Scheduling Calls to Regular Functions

10.5.4 Producing Results Asynchronously

10.5.5 Executing Tasks Concurrently

10.5.6 Composing Coroutines with Control Structures

10.5.7 Synchronization Primitives

10.5.8 Asynchronous I/O with Protocol Class Abstractions

10.5.9 Asynchronous I/O Using Coroutines and Streams

10.5.10 Using SSL

10.5.11 Interacting with Domain Name Services

10.5.12 Working with Subprocesses

10.5.13 Receiving Unix Signals

10.5.14 Combining Coroutines with Threads and Processes

10.5.15 Debugging with asyncio

10.6 concurrent.futures: Manage Pools of Concurrent Tasks

10.6.1 Using map() with a Basic Thread Pool

10.6.2 Scheduling Individual Tasks

10.6.3 Waiting for Tasks in Any Order

10.6.4 Future Callbacks

10.6.5 Canceling Tasks

10.6.6 Exceptions in Tasks

10.6.7 Context Manager

10.6.8 Process Pools

Chapter 11 Networking

11.1 ipaddress: Internet Addresses

11.1.1 Addresses

11.1.2 Networks

11.1.3 Interfaces

11.2 socket: Network Communication

11.2.1 Addressing, Protocol Families, and Socket Types

11.2.2 TCP/IP Client and Server

11.2.3 User Datagram Client and Server

11.2.4 Unix Domain Sockets

11.2.5 Multicast

11.2.6 Sending Binary Data

11.2.7 Non-blocking Communication and Timeouts

11.3 selectors: I/O Multiplexing Abstractions

11.3.1 Operating Model

11.3.2 Echo Server

11.3.3 Echo Client

11.3.4 Server and Client Together

11.4 select: Wait for I/O Efficiently

11.4.1 Using select()

11.4.2 Non-blocking I/O with Timeouts

11.4.3 Using poll()

11.4.4 Platform-Specific Options

11.5 socketserver: Creating Network Servers

11.5.1 Server Types

11.5.2 Server Objects

11.5.3 Implementing a Server

11.5.4 Request Handlers

11.5.5 Echo Example

11.5.6 Threading and Forking

Chapter 12 The Internet

12.1 urllib.parse: Split URLs into Components

12.1.1 Parsing

12.1.2 Unparsing

12.1.3 Joining

12.1.4 Encoding Query Arguments

12.2 urllib.request: Network Resource Access

12.2.1 HTTP GET

12.2.2 Encoding Arguments

12.2.3 HTTP POST

12.2.4 Adding Outgoing Headers

12.2.5 Posting Form Data from a Request

12.2.6 Uploading Files

12.2.7 Creating Custom Protocol Handlers

12.3 urllib.robotparser: Internet Spider Access Control

12.3.1 robots.txt

12.3.2 Testing Access Permissions

12.3.3 Long-Lived Spiders

12.4 base64: Encode Binary Data with ASCII

12.4.1 Base 64 Encoding

12.4.2 Base64 Decoding

12.4.3 URL-Safe Variations

12.4.4 Other Encodings

12.5 http.server: Base Classes for Implementing Web Servers

12.5.1 HTTP GET

12.5.2 HTTP POST

12.5.3 Threading and Forking

12.5.4 Handling Errors

12.5.5 Setting Headers

12.5.6 Command-Line Use

12.6 http.cookies: HTTP Cookies

12.6.1 Creating and Setting a Cookie

12.6.2 Morsels

12.6.3 Encoded Values

12.6.4 Receiving and Parsing Cookie Headers

12.6.5 Alternative Output Formats

12.7 webbrowser: Displays Web Pages

12.7.1 Simple Example

12.7.2 Windows Versus Tabs

12.7.3 Using a Specific Browser

12.7.4 BROWSER Variable

12.7.5 Command-Line Interface

12.8 uuid: Universally Unique Identifiers

12.8.1 UUID 1: IEEE 802 MAC Address

12.8.2 UUID 3 and 5: Name-Based Values

12.8.3 UUID 4: Random Values

12.8.4 Working with UUID Objects

12.9 json: JavaScript Object Notation

12.9.1 Encoding and Decoding Simple Data Types

12.9.2 Human-Consumable Versus Compact Output

12.9.3 Encoding Dictionaries

12.9.4 Working with Custom Types

12.9.5 Encoder and Decoder Classes

12.9.6 Working with Streams and Files

12.9.7 Mixed Data Streams

12.9.8 JSON at the Command Line

12.10 xmlrpc.client: Client Library for XML-RPC

12.10.1 Connecting to a Server

12.10.2 Data Types

12.10.3 Passing Objects

12.10.4 Binary Data

12.10.5 Exception Handling

12.10.6 Combining Calls into One Message

12.11 xmlrpc.server: An XML-RPC Server

12.11.1 A Simple Server

12.11.2 Alternate API Names

12.11.3 Dotted API Names

12.11.4 Arbitrary API Names

12.11.5 Exposing Methods of Objects

12.11.6 Dispatching Calls

12.11.7 Introspection API

Chapter 13 Email

13.1 smtplib: Simple Mail Transfer Protocol Client

13.1.1 Sending an Email Message

13.1.2 Authentication and Encryption

13.1.3 Verifying an Email Address

13.2 smtpd: Sample Mail Servers

13.2.1 Mail Server Base Class

13.2.2 Debugging Server

13.2.3 Proxy Server

13.3 mailbox: Manipulate Email Archives

13.3.1 mbox

13.3.2 Maildir

13.3.3 Message Flags

13.3.4 Other Formats

13.4 imaplib: IMAP4 Client Library

13.4.1 Variations

13.4.2 Connecting to a Server

13.4.3 Example Configuration

13.4.4 Listing Mailboxes

13.4.5 Mailbox Status

13.4.6 Selecting a Mailbox

13.4.7 Searching for Messages

13.4.8 Search Criteria

13.4.9 Fetching Messages

13.4.10 Whole Messages

13.4.11 Uploading Messages

13.4.12 Moving and Copying Messages

13.4.13 Deleting Messages

Chapter 14 Application Building Blocks

14.1 argparse: Command-Line Option and Argument Parsing

14.1.1 Setting Up a Parser

14.1.2 Defining Arguments

14.1.3 Parsing a Command Line

14.1.4 Simple Examples

14.1.5 Help Output

14.1.6 Parser Organization

14.1.7 Advanced Argument Processing

14.2 getopt: Command-Line Option Parsing

14.2.1 Function Arguments

14.2.2 Short-Form Options

14.2.3 Long-Form Options

14.2.4 A Complete Example

14.2.5 Abbreviating Long-Form Options

14.2.6 GNU-Style Option Parsing

14.2.7 Ending Argument Processing

14.3 readline: The GNU readline Library

14.3.1 Configuring readline

14.3.2 Completing Text

14.3.3 Accessing the Completion Buffer

14.3.4 Input History

14.3.5 Hooks

14.4 getpass: Secure Password Prompt

14.4.1 Example

14.4.2 Using getpass Without a Terminal

14.5 cmd: Line-Oriented Command Processors

14.5.1 Processing Commands

14.5.2 Command Arguments

14.5.3 Live Help

14.5.4 Auto-Completion

14.5.5 Overriding Base Class Methods

14.5.6 Configuring Cmd Through Attributes

14.5.7 Running Shell Commands

14.5.8 Alternative Inputs

14.5.9 Commands from sys.argv

14.6 shlex: Parse Shell-Style Syntaxes

14.6.1 Parsing Quoted Strings

14.6.2 Making Safe Strings for Shells

14.6.3 Embedded Comments

14.6.4 Splitting Strings into Tokens

14.6.5 Including Other Sources of Tokens

14.6.6 Controlling the Parser

14.6.7 Error Handling

14.6.8 POSIX Versus Non-POSIX Parsing

14.7 configparser: Work with Configuration Files

14.7.1 Configuration File Format

14.7.2 Reading Configuration Files

14.7.3 Accessing Configuration Settings

14.7.4 Modifying Settings

14.7.5 Saving Configuration Files

14.7.6 Option Search Path

14.7.7 Combining Values with Interpolation

14.8 logging: Report Status, Error, and Informational Messages

14.8.1 Logging Components

14.8.2 Logging in Applications Versus Libraries

14.8.3 Logging to a File

14.8.4 Rotating Log Files

14.8.5 Verbosity Levels

14.8.6 Naming Logger Instances

14.8.7 The Logging Tree

14.8.8 Integration with the warnings Module

14.9 fileinput: Command-Line Filter Framework

14.9.1 Converting M3U Files to RSS

14.9.2 Progress Metadata

14.9.3 In-Place Filtering

14.10 atexit: Program Shutdown Callbacks

14.10.1 Registering Exit Callbacks

14.10.2 Decorator Syntax

14.10.3 Canceling Callbacks

14.10.4 When Are atexit Callbacks Not Called?

14.10.5 Handling Exceptions

14.11 sched: Timed Event Scheduler

14.11.1 Running Events with a Delay

14.11.2 Overlapping Events

14.11.3 Event Priorities

14.11.4 Canceling Events

Chapter 15 Internationalization and Localization

15.1 gettext: Message Catalogs

15.1.1 Translation Workflow Overview

15.1.2 Creating Message Catalogs from Source Code

15.1.3 Finding Message Catalogs at Runtime

15.1.4 Plural Values

15.1.5 Application Versus Module Localization

15.1.6 Switching Translations

15.2 locale: Cultural Localization API

15.2.1 Probing the Current Locale

15.2.2 Currency

15.2.3 Formatting Numbers

15.2.4 Parsing Numbers

15.2.5 Dates and Times

Chapter 16 Developer Tools

16.1 pydoc: Online Help for Modules

16.1.1 Plain Text Help

16.1.2 HTML Help

16.1.3 Interactive Help

16.2 doctest: Testing Through Documentation

16.2.1 Getting Started

16.2.2 Handling Unpredictable Output

16.2.3 Tracebacks

16.2.4 Working Around Whitespace

16.2.5 Test Locations

16.2.6 External Documentation

16.2.7 Running Tests

16.2.8 Test Context

16.3 unittest: Automated Testing Framework

16.3.1 Basic Test Structure

16.3.2 Running Tests

16.3.3 Test Outcomes

16.3.4 Asserting Truth

16.3.5 Testing Equality

16.3.6 Almost Equal?

16.3.7 Containers

16.3.8 Testing for Exceptions

16.3.9 Test Fixtures

16.3.10 Repeating Tests with Different Inputs

16.3.11 Skipping Tests

16.3.12 Ignoring Failing Tests

16.4 trace: Follow Program Flow

16.4.1 Example Program

16.4.2 Tracing Execution

16.4.3 Code Coverage

16.4.4 Calling Relationships

16.4.5 Programming Interface

16.4.6 Saving Result Data

16.4.7 Options

16.5 traceback: Exceptions and Stack Traces

16.5.1 Supporting Functions

16.5.2 Examining the Stack

16.5.3 TracebackException

16.5.4 Low-Level Exception APIs

16.5.5 Low-Level Stack APIs

16.6 cgitb: Detailed Traceback Reports

16.6.1 Standard Traceback Dumps

16.6.2 Enabling Detailed Tracebacks

16.6.3 Local Variables in Tracebacks

16.6.4 Exception Properties

16.6.5 HTML Output

16.6.6 Logging Tracebacks

16.7 pdb: Interactive Debugger

16.7.1 Starting the Debugger

16.7.2 Controlling the Debugger

16.7.3 Breakpoints

16.7.4 Changing Execution Flow

16.7.5 Customizing the Debugger with Aliases

16.7.6 Saving Configuration Settings

16.8 profile and pstats: Performance Analysis

16.8.1 Running the Profiler

16.8.2 Running in a Context

16.8.3 pstats: Saving and Working with Statistics

16.8.4 Limiting Report Contents

16.8.5 Caller/Callee Graphs

16.9 timeit: Time the Execution of Small Bits of Python Code

16.9.1 Module Contents

16.9.2 Basic Example

16.9.3 Storing Values in a Dictionary

16.9.4 From the Command Line

16.10 tabnanny: Indentation Validator

16.10.1 Running from the Command Line

16.11 compileall: Byte-Compile Source Files

16.11.1 Compiling One Directory

16.11.2 Ignoring Files

16.11.3 Compiling sys.path

16.11.4 Compiling Individual Files

16.11.5 From the Command Line

16.12 pyclbr: Class Browser

16.12.1 Scanning for Classes

16.12.2 Scanning for Functions

16.13 venv: Create Virtual Environments

16.13.1 Creating Environments

16.13.2 Contents of a Virtual Environment

16.13.3 Using Virtual Environments

16.14 ensurepip: Install the Python Package Installer

16.14.1 Installing pip

Chapter 17 Runtime Features

17.1 site: Site-wide Configuration

17.1.1 Import Path

17.1.2 User Directories

17.1.3 Path Configuration Files

17.1.4 Customizing Site Configuration

17.1.5 Customizing User Configuration

17.1.6 Disabling the site Module

17.2 sys: System-Specific Configuration

17.2.1 Interpreter Settings

17.2.2 Runtime Environment

17.2.3 Memory Management and Limits

17.2.4 Exception Handling

17.2.5 Low-Level Thread Support

17.2.6 Modules and Imports

17.2.7 Tracing a Program As It Runs

17.3 os: Portable Access to Operating System–Specific Features

17.3.1 Examining the File System Contents

17.3.2 Managing File System Permissions

17.3.3 Creating and Deleting Directories

17.3.4 Working with Symbolic Links

17.3.5 Safely Replacing an Existing File

17.3.6 Detecting and Changing the Process Owner

17.3.7 Managing the Process Environment

17.3.8 Managing the Process Working Directory

17.3.9 Running External Commands

17.3.10 Creating Processes with os.fork()

17.3.11 Waiting for Child Processes

17.3.12 Spawning New Processes

17.3.13 Operating System Error Codes

17.4 platform: System Version Information

17.4.1 Interpreter

17.4.2 Platform

17.4.3 Operating System and Hardware Information

17.4.4 Executable Architecture

17.5 resource: System Resource Management

17.5.1 Current Usage

17.5.2 Resource Limits

17.6 gc: Garbage Collector

17.6.1 Tracing References

17.6.2 Forcing Garbage Collection

17.6.3 Finding References to Objects That Cannot Be Collected

17.6.4 Collection Thresholds and Generations

17.6.5 Debugging

17.7 sysconfig: Interpreter Compile-Time Configuration

17.7.1 Configuration Variables

17.7.2 Installation Paths

17.7.3 Python Version and Platform

Chapter 18 Language Tools

18.1 warnings: Non-fatal Alerts

18.1.1 Categories and Filtering

18.1.2 Generating Warnings

18.1.3 Filtering with Patterns

18.1.4 Repeated Warnings

18.1.5 Alternative Message Delivery Functions

18.1.6 Formatting

18.1.7 Stack Level in Warnings

18.2 abc: Abstract Base Classes

18.2.1 How ABCs Work

18.2.2 Registering a Concrete Class

18.2.3 Implementation Through Subclassing

18.2.4 Helper Base Class

18.2.5 Incomplete Implementations

18.2.6 Concrete Methods in ABCs

18.2.7 Abstract Properties

18.2.8 Abstract Class and Static Methods

18.3 dis: Python Byte-Code Disassembler

18.3.1 Basic Disassembly

18.3.2 Disassembling Functions

18.3.3 Classes

18.3.4 Source Code

18.3.5 Using Disassembly to Debug

18.3.6 Performance Analysis of Loops

18.3.7 Compiler Optimizations

18.4 inspect: Inspect Live Objects

18.4.1 Example Module

18.4.2 Inspecting Modules

18.4.3 Inspecting Classes

18.4.4 Inspecting Instances

18.4.5 Documentation Strings

18.4.6 Retrieving Source

18.4.7 Method and Function Signatures

18.4.8 Class Hierarchies

18.4.9 Method Resolution Order

18.4.10 The Stack and Frames

18.4.11 Command-Line Interface

19.1 importlib: Python’s Import Mechanism

Chapter 19 Modules and Packages

19.1.1 Example Package

19.1.2 Module Types

19.1.3 Importing Modules

19.1.4 Loaders

19.2 pkgutil: Package Utilities

19.2.1 Package Import Paths

19.2.2 Development Versions of Packages

19.2.3 Managing Paths with PKG Files

19.2.4 Nested Packages

19.2.5 Package Data

19.3 zipimport: Load Python Code from ZIP Archives

19.3.1 Example

19.3.2 Finding a Module

19.3.3 Accessing Code

19.3.4 Source

19.3.5 Packages

19.3.6 Data

Appendix A Porting Notes

A.1 References

A.2 New Modules

A.3 Renamed Modules

A.4 Removed Modules

A.4.1 bsddb

A.4.2 commands

A.4.3 compiler

A.4.4 dircache

A.4.5 EasyDialogs

A.4.6 exceptions

A.4.7 htmllib

A.4.8 md5

A.4.9 mimetools, MimeWriter, mimify, multifile, and rfc822

A.4.10 popen2

A.4.11 posixfile

A.4.12 sets

A.4.13 sha

A.4.14 sre

A.4.15 statvfs

A.4.16 thread

A.4.17 user

A.5 Deprecated Modules

A.5.1 asyncore and asynchat

A.5.2 formatter

A.5.3 imp

A.5.4 optparse

A.6 Summary of Changes to Modules

A.6.1 abc

A.6.2 anydbm

A.6.3 argparse

A.6.4 array

A.6.5 atexit

A.6.6 base64

A.6.7 bz2

A.6.8 collections

A.6.9 comands

A.6.10 configparser

A.6.11 contextlib

A.6.12 csv

A.6.13 datetime

A.6.14 decimal

A.6.15 fractions

A.6.16 gc

A.6.17 gettext

A.6.18 glob

A.6.19 http.cookies

A.6.20 imaplib

A.6.21 inspect

A.6.22 itertools

A.6.23 json

A.6.24 locale

A.6.25 logging

A.6.26 mailbox

A.6.27 mmap

A.6.28 operator

A.6.29 os

A.6.30 os.path

A.6.31 pdb

A.6.32 pickle

A.6.33 pipes

A.6.34 platform

A.6.35 random

A.6.36 re

A.6.37 shelve

A.6.38 signal

A.6.39 socket

A.6.40 socketserver

A.6.41 string

A.6.42 struct

A.6.43 subprocess

A.6.44 sys

A.6.45 threading

A.6.46 time

A.6.47 unittest

A.6.48 UserDict, UserList, and UserString

A.6.49 uuid

A.6.50 whichdb

A.6.51 xml.etree.ElementTree

A.6.52 zipimport

Appendix B Outside of the Standard Library

B.1 Text

B.2 Algorithms

B.3 Dates and Times

B.4 Mathematics

B.5 Data Persistence and Exchange

B.6 Cryptography

B.7 Concurrency with Processes, Threads, and Coroutines

B.8 The Internet

B.9 Email

B.10 Application Building Blocks

B.11 Developer Tools

Index of Python Modules

Index

Sources:

Fair Use Sources: