(python3.11.info)Top


Next: What’s New in Python Up: (dir)
Enter node , (file) or (file)node

Python
******

     Python 3.11.2, March 02, 2024

     unknown

     Copyright © 2001-2024, Python Software Foundation

What’s New in Python
The Python Tutorial
Python Setup and Usage
The Python Language Reference
The Python Standard Library
Extending and Embedding the Python Interpreter
Python/C API Reference Manual
Distributing Python Modules
Installing Python Modules
Python HOWTOs
Python Frequently Asked Questions
Glossary
About these documents
Dealing with Bugs
Copyright
History and License
Distributing Python Modules (Legacy version)
Distributing Python Modules Legacy version.
Installing Python Modules (Legacy version)
Installing Python Modules Legacy version.
Python Module Index
Index
 — The Detailed Node Listing —

What’s New in Python

What’s New In Python 3.11
What’s New In Python 3 11.
What’s New In Python 3.10
What’s New In Python 3 10.
What’s New In Python 3.9
What’s New In Python 3 9.
What’s New In Python 3.8
What’s New In Python 3 8.
What’s New In Python 3.7
What’s New In Python 3 7.
What’s New In Python 3.6
What’s New In Python 3 6.
What’s New In Python 3.5
What’s New In Python 3 5.
What’s New In Python 3.4
What’s New In Python 3 4.
What’s New In Python 3.3
What’s New In Python 3 3.
What’s New In Python 3.2
What’s New In Python 3 2.
What’s New In Python 3.1
What’s New In Python 3 1.
What’s New In Python 3.0
What’s New In Python 3 0.
What’s New in Python 2.7
What’s New in Python 2 7.
What’s New in Python 2.6
What’s New in Python 2 6.
What’s New in Python 2.5
What’s New in Python 2 5.
What’s New in Python 2.4
What’s New in Python 2 4.
What’s New in Python 2.3
What’s New in Python 2 3.
What’s New in Python 2.2
What’s New in Python 2 2.
What’s New in Python 2.1
What’s New in Python 2 1.
What’s New in Python 2.0
What’s New in Python 2 0.
Changelog
What’s New In Python 3.11

Summary – Release highlights
New Features
New Features Related to Type Hints
Other Language Changes
Other CPython Implementation Changes
New Modules
Improved Modules
Optimizations
Faster CPython
CPython bytecode changes
Deprecated
Pending Removal in Python 3.12
Pending Removal in Python 3 12.
Removed
Porting to Python 3.11
Porting to Python 3 11.
Build Changes
C API Changes
New Features

PEP 657; Fine-grained error locations in tracebacks
PEP 657 Fine-grained error locations in tracebacks.
PEP 654; Exception Groups and except*
PEP 654 Exception Groups and except*.
PEP 678; Exceptions can be enriched with notes
PEP 678 Exceptions can be enriched with notes.
Windows py.exe launcher improvements
Windows py exe launcher improvements.
New Features Related to Type Hints

PEP 646; Variadic generics
PEP 646 Variadic generics.
PEP 655; Marking individual TypedDict items as required or not-required
PEP 655 Marking individual TypedDict items as required or not-required.
PEP 673; Self type
PEP 673 Self type.
PEP 675; Arbitrary literal string type
PEP 675 Arbitrary literal string type.
PEP 681; Data class transforms
PEP 681 Data class transforms.
PEP 563 may not be the future
Improved Modules

asyncio
contextlib
dataclasses
datetime
enum
fcntl
fractions
functools
hashlib
IDLE and idlelib
inspect
locale
logging
math
operator
os
pathlib
re
shutil
socket
sqlite3
string
sys
sysconfig
tempfile
threading
time
tkinter
traceback
typing
unicodedata
unittest
venv
warnings
zipfile
Faster CPython

Faster Startup
Faster Runtime
Misc
FAQ
About
Faster Startup

Frozen imports / Static code objects
Faster Runtime

Cheaper, lazy Python frames
Cheaper lazy Python frames.
Inlined Python function calls
PEP 659; Specializing Adaptive Interpreter
PEP 659 Specializing Adaptive Interpreter.
CPython bytecode changes

New opcodes
Replaced opcodes
Changed/removed opcodes
Deprecated

Language/Builtins
Modules
Standard Library
C API Changes

New Features
New Features<2>.
Porting to Python 3.11
Porting to Python 3 11<2>.
Deprecated
Deprecated<2>.
Pending Removal in Python 3.12
Pending Removal in Python 3 12<2>.
Removed
Removed<2>.
What’s New In Python 3.10

Summary – Release highlights
Summary – Release highlights<2>.
New Features
New Features<3>.
New Features Related to Type Hints
New Features Related to Type Hints<2>.
Other Language Changes
Other Language Changes<2>.
New Modules
New Modules<2>.
Improved Modules
Improved Modules<2>.
Optimizations
Optimizations<2>.
Deprecated
Deprecated<3>.
Removed
Removed<3>.
Porting to Python 3.10
Porting to Python 3 10.
CPython bytecode changes
CPython bytecode changes<2>.
Build Changes
Build Changes<2>.
C API Changes
C API Changes<2>.
New Features

Parenthesized context managers
Better error messages
PEP 626; Precise line numbers for debugging and other tools
PEP 626 Precise line numbers for debugging and other tools.
PEP 634; Structural Pattern Matching
PEP 634 Structural Pattern Matching.
Optional EncodingWarning and encoding="locale" option
Better error messages

SyntaxErrors
IndentationErrors
AttributeErrors
NameErrors
PEP 634: Structural Pattern Matching

Syntax and operations
Declarative approach
Simple pattern; match to a literal
Simple pattern match to a literal.
Patterns with a literal and variable
Patterns and classes
Nested patterns
Complex patterns and the wildcard
Guard
Other Key Features
Simple pattern: match to a literal

Behavior without the wildcard
Patterns and classes

Patterns with positional parameters
New Features Related to Type Hints

PEP 604; New Type Union Operator
PEP 604 New Type Union Operator.
PEP 612; Parameter Specification Variables
PEP 612 Parameter Specification Variables.
PEP 613; TypeAlias
PEP 613 TypeAlias.
PEP 647; User-Defined Type Guards
PEP 647 User-Defined Type Guards.
Improved Modules

asyncio
asyncio<2>.
argparse
array
asynchat, asyncore, smtpd
asynchat asyncore smtpd.
base64
bdb
bisect
codecs
collections.abc
collections abc.
contextlib
contextlib<2>.
curses
dataclasses
dataclasses<2>.
distutils
doctest
encodings
enum
enum<2>.
fileinput
faulthandler
gc
glob
hashlib
hashlib<2>.
hmac
IDLE and idlelib
IDLE and idlelib<2>.
importlib.metadata
importlib metadata.
inspect
inspect<2>.
itertools
linecache
os
os<2>.
os.path
os path.
pathlib
pathlib<2>.
platform
pprint
py_compile
pyclbr
shelve
statistics
site
socket
socket<2>.
ssl
sqlite3
sqlite3<2>.
sys
sys<2>.
_thread
threading
threading<2>.
traceback
traceback<2>.
types
typing
typing<2>.
unittest
unittest<2>.
urllib.parse
urllib parse.
xml
zipimport
dataclasses

__slots__
Keyword-only fields
Porting to Python 3.10

Changes in the Python syntax
Changes in the Python API
Changes in the C API
C API Changes

PEP 652; Maintaining the Stable ABI
PEP 652 Maintaining the Stable ABI.
New Features
New Features<4>.
Porting to Python 3.10
Porting to Python 3 10<2>.
Deprecated
Deprecated<4>.
Removed
Removed<4>.
What’s New In Python 3.9

Summary – Release highlights
Summary – Release highlights<3>.
You should check for DeprecationWarning in your code
New Features
New Features<5>.
Other Language Changes
Other Language Changes<3>.
New Modules
New Modules<3>.
Improved Modules
Improved Modules<3>.
Optimizations
Optimizations<3>.
Deprecated
Deprecated<5>.
Removed
Removed<5>.
Porting to Python 3.9
Porting to Python 3 9.
Build Changes
Build Changes<3>.
C API Changes
C API Changes<3>.
Notable changes in Python 3.9.1
Notable changes in Python 3 9 1.
Notable changes in Python 3.9.2
Notable changes in Python 3 9 2.
New Features

Dictionary Merge & Update Operators
New String Methods to Remove Prefixes and Suffixes
Type Hinting Generics in Standard Collections
New Parser
New Modules

zoneinfo
graphlib
Improved Modules

ast
asyncio
asyncio<3>.
compileall
concurrent.futures
concurrent futures.
curses
curses<2>.
datetime
datetime<2>.
distutils
distutils<2>.
fcntl
fcntl<2>.
ftplib
gc
gc<2>.
hashlib
hashlib<3>.
http
IDLE and idlelib
IDLE and idlelib<3>.
imaplib
importlib
inspect
inspect<3>.
ipaddress
math
math<2>.
multiprocessing
nntplib
os
os<3>.
pathlib
pathlib<3>.
pdb
poplib
pprint
pprint<2>.
pydoc
random
signal
smtplib
socket
socket<3>.
time
time<2>.
sys
sys<3>.
tracemalloc
typing
typing<3>.
unicodedata
unicodedata<2>.
venv
venv<2>.
xml
xml<2>.
Porting to Python 3.9

Changes in the Python API
Changes in the Python API<2>.
Changes in the C API
Changes in the C API<2>.
CPython bytecode changes
CPython bytecode changes<3>.
C API Changes

New Features
New Features<6>.
Porting to Python 3.9
Porting to Python 3 9<2>.
Removed
Removed<6>.
Notable changes in Python 3.9.1

typing
typing<4>.
macOS 11.0 (Big Sur) and Apple Silicon Mac support
macOS 11 0 Big Sur and Apple Silicon Mac support.
Notable changes in Python 3.9.2

collections.abc
collections abc<2>.
urllib.parse
urllib parse<2>.
What’s New In Python 3.8

Summary – Release highlights
Summary – Release highlights<4>.
New Features
New Features<7>.
Other Language Changes
Other Language Changes<4>.
New Modules
New Modules<4>.
Improved Modules
Improved Modules<4>.
Optimizations
Optimizations<4>.
Build and C API Changes
Deprecated
Deprecated<6>.
API and Feature Removals
Porting to Python 3.8
Porting to Python 3 8.
Notable changes in Python 3.8.1
Notable changes in Python 3 8 1.
Notable changes in Python 3.8.8
Notable changes in Python 3 8 8.
Notable changes in Python 3.8.12
Notable changes in Python 3 8 12.
New Features

Assignment expressions
Positional-only parameters
Parallel filesystem cache for compiled bytecode files
Debug build uses the same ABI as release build
f-strings support = for self-documenting expressions and debugging
PEP 578; Python Runtime Audit Hooks
PEP 578 Python Runtime Audit Hooks.
PEP 587; Python Initialization Configuration
PEP 587 Python Initialization Configuration.
PEP 590; Vectorcall; a fast calling protocol for CPython
PEP 590 Vectorcall a fast calling protocol for CPython.
Pickle protocol 5 with out-of-band data buffers
Improved Modules

ast
ast<2>.
asyncio
asyncio<4>.
builtins
collections
cProfile
csv
curses
curses<3>.
ctypes
datetime
datetime<3>.
functools
functools<2>.
gc
gc<3>.
gettext
gzip
IDLE and idlelib
IDLE and idlelib<4>.
inspect
inspect<4>.
io
itertools
itertools<2>.
json.tool
json tool.
logging
logging<2>.
math
math<3>.
mmap
multiprocessing
multiprocessing<2>.
os
os<4>.
os.path
os path<2>.
pathlib
pathlib<4>.
pickle
plistlib
pprint
pprint<3>.
py_compile
py_compile<2>.
shlex
shutil
shutil<2>.
socket
socket<4>.
ssl
ssl<2>.
statistics
statistics<2>.
sys
sys<4>.
tarfile
threading
threading<3>.
tokenize
tkinter
tkinter<2>.
time
time<3>.
typing
typing<5>.
unicodedata
unicodedata<3>.
unittest
unittest<3>.
venv
venv<3>.
weakref
xml
xml<3>.
xmlrpc
Porting to Python 3.8

Changes in Python behavior
Changes in the Python API
Changes in the Python API<3>.
Changes in the C API
Changes in the C API<3>.
CPython bytecode changes
CPython bytecode changes<4>.
Demos and Tools
What’s New In Python 3.7

Summary – Release Highlights
New Features
New Features<8>.
Other Language Changes
Other Language Changes<5>.
New Modules
New Modules<5>.
Improved Modules
Improved Modules<5>.
C API Changes
C API Changes<4>.
Build Changes
Build Changes<4>.
Optimizations
Optimizations<5>.
Other CPython Implementation Changes
Other CPython Implementation Changes<2>.
Deprecated Python Behavior
Deprecated Python modules, functions and methods
Deprecated Python modules functions and methods.
Deprecated functions and types of the C API
Platform Support Removals
API and Feature Removals
API and Feature Removals<2>.
Module Removals
Windows-only Changes
Porting to Python 3.7
Porting to Python 3 7.
Notable changes in Python 3.7.1
Notable changes in Python 3 7 1.
Notable changes in Python 3.7.2
Notable changes in Python 3 7 2.
Notable changes in Python 3.7.6
Notable changes in Python 3 7 6.
Notable changes in Python 3.7.10
Notable changes in Python 3 7 10.
New Features

PEP 563; Postponed Evaluation of Annotations
PEP 563 Postponed Evaluation of Annotations.
PEP 538; Legacy C Locale Coercion
PEP 538 Legacy C Locale Coercion.
PEP 540; Forced UTF-8 Runtime Mode
PEP 540 Forced UTF-8 Runtime Mode.
PEP 553; Built-in breakpoint()
PEP 553 Built-in breakpoint.
PEP 539; New C API for Thread-Local Storage
PEP 539 New C API for Thread-Local Storage.
PEP 562; Customization of Access to Module Attributes
PEP 562 Customization of Access to Module Attributes.
PEP 564; New Time Functions With Nanosecond Resolution
PEP 564 New Time Functions With Nanosecond Resolution.
PEP 565; Show DeprecationWarning in __main__
PEP 565 Show DeprecationWarning in __main__.
PEP 560; Core Support for typing module and Generic Types
PEP 560 Core Support for typing module and Generic Types.
PEP 552; Hash-based .pyc Files
PEP 552 Hash-based pyc Files.
PEP 545; Python Documentation Translations
PEP 545 Python Documentation Translations.
Python Development Mode (-X dev)
Python Development Mode -X dev.
New Modules

contextvars
dataclasses
dataclasses<3>.
importlib.resources
importlib resources.
Improved Modules

argparse
argparse<2>.
asyncio
asyncio<5>.
binascii
calendar
collections
collections<2>.
compileall
compileall<2>.
concurrent.futures
concurrent futures<2>.
contextlib
contextlib<3>.
cProfile
cProfile<2>.
crypt
datetime
datetime<4>.
dbm
decimal
dis
distutils
distutils<3>.
enum
enum<3>.
functools
functools<3>.
gc
gc<4>.
hmac
hmac<2>.
http.client
http client.
http.server
http server.
idlelib and IDLE
importlib
importlib<2>.
io
io<2>.
ipaddress
ipaddress<2>.
itertools
itertools<3>.
locale
locale<2>.
logging
logging<3>.
math
math<4>.
mimetypes
msilib
multiprocessing
multiprocessing<3>.
os
os<5>.
pathlib
pathlib<5>.
pdb
pdb<2>.
py_compile
py_compile<3>.
pydoc
pydoc<2>.
queue
re
re<2>.
signal
signal<2>.
socket
socket<5>.
socketserver
sqlite3
sqlite3<3>.
ssl
ssl<3>.
string
string<2>.
subprocess
sys
sys<5>.
time
time<4>.
tkinter
tkinter<3>.
tracemalloc
tracemalloc<2>.
types
types<2>.
unicodedata
unicodedata<4>.
unittest
unittest<4>.
unittest.mock
unittest mock.
urllib.parse
urllib parse<3>.
uu
uuid
warnings
warnings<2>.
xml.etree
xml etree.
xmlrpc.server
xmlrpc server.
zipapp
zipfile
zipfile<2>.
Deprecated Python modules, functions and methods

aifc
asyncio
asyncio<6>.
collections
collections<3>.
dbm
dbm<2>.
enum
enum<4>.
gettext
gettext<2>.
importlib
importlib<3>.
locale
locale<3>.
macpath
threading
threading<4>.
socket
socket<6>.
ssl
ssl<4>.
sunau
sys
sys<6>.
wave
Porting to Python 3.7

Changes in Python Behavior
Changes in the Python API
Changes in the Python API<4>.
Changes in the C API
Changes in the C API<4>.
CPython bytecode changes
CPython bytecode changes<5>.
Windows-only Changes
Windows-only Changes<2>.
Other CPython implementation changes
What’s New In Python 3.6

Summary – Release highlights
Summary – Release highlights<5>.
New Features
New Features<9>.
Other Language Changes
Other Language Changes<6>.
New Modules
New Modules<6>.
Improved Modules
Improved Modules<6>.
Optimizations
Optimizations<6>.
Build and C API Changes
Build and C API Changes<2>.
Other Improvements
Deprecated
Deprecated<7>.
Removed
Removed<7>.
Porting to Python 3.6
Porting to Python 3 6.
Notable changes in Python 3.6.2
Notable changes in Python 3 6 2.
Notable changes in Python 3.6.4
Notable changes in Python 3 6 4.
Notable changes in Python 3.6.5
Notable changes in Python 3 6 5.
Notable changes in Python 3.6.7
Notable changes in Python 3 6 7.
Notable changes in Python 3.6.10
Notable changes in Python 3 6 10.
Notable changes in Python 3.6.13
Notable changes in Python 3 6 13.
New Features

PEP 498; Formatted string literals
PEP 498 Formatted string literals.
PEP 526; Syntax for variable annotations
PEP 526 Syntax for variable annotations.
PEP 515; Underscores in Numeric Literals
PEP 515 Underscores in Numeric Literals.
PEP 525; Asynchronous Generators
PEP 525 Asynchronous Generators.
PEP 530; Asynchronous Comprehensions
PEP 530 Asynchronous Comprehensions.
PEP 487; Simpler customization of class creation
PEP 487 Simpler customization of class creation.
PEP 487; Descriptor Protocol Enhancements
PEP 487 Descriptor Protocol Enhancements.
PEP 519; Adding a file system path protocol
PEP 519 Adding a file system path protocol.
PEP 495; Local Time Disambiguation
PEP 495 Local Time Disambiguation.
PEP 529; Change Windows filesystem encoding to UTF-8
PEP 529 Change Windows filesystem encoding to UTF-8.
PEP 528; Change Windows console encoding to UTF-8
PEP 528 Change Windows console encoding to UTF-8.
PEP 520; Preserving Class Attribute Definition Order
PEP 520 Preserving Class Attribute Definition Order.
PEP 468; Preserving Keyword Argument Order
PEP 468 Preserving Keyword Argument Order.
New dict implementation
PEP 523; Adding a frame evaluation API to CPython
PEP 523 Adding a frame evaluation API to CPython.
PYTHONMALLOC environment variable
DTrace and SystemTap probing support
New Modules

secrets
Improved Modules

array
array<2>.
ast
ast<3>.
asyncio
asyncio<7>.
binascii
binascii<2>.
cmath
collections
collections<4>.
concurrent.futures
concurrent futures<3>.
contextlib
contextlib<4>.
datetime
datetime<5>.
decimal
decimal<2>.
distutils
distutils<4>.
email
encodings
encodings<2>.
enum
enum<5>.
faulthandler
faulthandler<2>.
fileinput
fileinput<2>.
hashlib
hashlib<4>.
http.client
http client<2>.
idlelib and IDLE
idlelib and IDLE<2>.
importlib
importlib<4>.
inspect
inspect<5>.
json
logging
logging<4>.
math
math<5>.
multiprocessing
multiprocessing<4>.
os
os<6>.
pathlib
pathlib<6>.
pdb
pdb<3>.
pickle
pickle<2>.
pickletools
pydoc
pydoc<3>.
random
random<2>.
re
re<3>.
readline
rlcompleter
shlex
shlex<2>.
site
site<2>.
sqlite3
sqlite3<4>.
socket
socket<7>.
socketserver
socketserver<2>.
ssl
ssl<5>.
statistics
statistics<3>.
struct
subprocess
subprocess<2>.
sys
sys<7>.
telnetlib
time
time<5>.
timeit
tkinter
tkinter<4>.
traceback
traceback<3>.
tracemalloc
tracemalloc<3>.
typing
typing<6>.
unicodedata
unicodedata<5>.
unittest.mock
unittest mock<2>.
urllib.request
urllib request.
urllib.robotparser
urllib robotparser.
venv
venv<4>.
warnings
warnings<3>.
winreg
winsound
xmlrpc.client
xmlrpc client.
zipfile
zipfile<3>.
zlib
Deprecated

New Keywords
Deprecated Python behavior
Deprecated Python modules, functions and methods
Deprecated Python modules functions and methods<2>.
Deprecated functions and types of the C API
Deprecated functions and types of the C API<2>.
Deprecated Build Options
Deprecated Python modules, functions and methods

asynchat
asyncore
dbm
dbm<3>.
distutils
distutils<5>.
grp
importlib
importlib<5>.
os
os<7>.
re
re<4>.
ssl
ssl<6>.
tkinter
tkinter<5>.
venv
venv<5>.
Removed

API and Feature Removals
API and Feature Removals<3>.
Porting to Python 3.6

Changes in ‘python’ Command Behavior
Changes in the Python API
Changes in the Python API<5>.
Changes in the C API
Changes in the C API<5>.
CPython bytecode changes
CPython bytecode changes<6>.
Notable changes in Python 3.6.2

New make regen-all build target
Removal of make touch build target
What’s New In Python 3.5

Summary – Release highlights
Summary – Release highlights<6>.
New Features
New Features<10>.
Other Language Changes
Other Language Changes<7>.
New Modules
New Modules<7>.
Improved Modules
Improved Modules<7>.
Other module-level changes
Optimizations
Optimizations<7>.
Build and C API Changes
Build and C API Changes<3>.
Deprecated
Deprecated<8>.
Removed
Removed<8>.
Porting to Python 3.5
Porting to Python 3 5.
Notable changes in Python 3.5.4
Notable changes in Python 3 5 4.
New Features

PEP 492 - Coroutines with async and await syntax
PEP 465 - A dedicated infix operator for matrix multiplication
PEP 448 - Additional Unpacking Generalizations
PEP 461 - percent formatting support for bytes and bytearray
PEP 484 - Type Hints
PEP 471 - os.scandir() function – a better and faster directory iterator
PEP 471 - os scandir function – a better and faster directory iterator.
PEP 475; Retry system calls failing with EINTR
PEP 475 Retry system calls failing with EINTR.
PEP 479; Change StopIteration handling inside generators
PEP 479 Change StopIteration handling inside generators.
PEP 485; A function for testing approximate equality
PEP 485 A function for testing approximate equality.
PEP 486; Make the Python Launcher aware of virtual environments
PEP 486 Make the Python Launcher aware of virtual environments.
PEP 488; Elimination of PYO files
PEP 488 Elimination of PYO files.
PEP 489; Multi-phase extension module initialization
PEP 489 Multi-phase extension module initialization.
New Modules

typing
typing<7>.
zipapp
zipapp<2>.
Improved Modules

argparse
argparse<3>.
asyncio
asyncio<8>.
bz2
cgi
cmath
cmath<2>.
code
collections
collections<5>.
collections.abc
collections abc<3>.
compileall
compileall<3>.
concurrent.futures
concurrent futures<4>.
configparser
contextlib
contextlib<5>.
csv
csv<2>.
curses
curses<4>.
dbm
dbm<4>.
difflib
distutils
distutils<6>.
doctest
doctest<2>.
email
email<2>.
enum
enum<6>.
faulthandler
faulthandler<3>.
functools
functools<4>.
glob
glob<2>.
gzip
gzip<2>.
heapq
http
http<2>.
http.client
http client<3>.
idlelib and IDLE
idlelib and IDLE<3>.
imaplib
imaplib<2>.
imghdr
importlib
importlib<6>.
inspect
inspect<6>.
io
io<3>.
ipaddress
ipaddress<3>.
json
json<2>.
linecache
linecache<2>.
locale
locale<4>.
logging
logging<5>.
lzma
math
math<6>.
multiprocessing
multiprocessing<5>.
operator
operator<2>.
os
os<8>.
pathlib
pathlib<7>.
pickle
pickle<3>.
poplib
poplib<2>.
re
re<5>.
readline
readline<2>.
selectors
shutil
shutil<3>.
signal
signal<3>.
smtpd
smtplib
smtplib<2>.
sndhdr
socket
socket<8>.
ssl
ssl<7>.
sqlite3
sqlite3<5>.
subprocess
subprocess<3>.
sys
sys<8>.
sysconfig
sysconfig<2>.
tarfile
tarfile<2>.
threading
threading<5>.
time
time<6>.
timeit
timeit<2>.
tkinter
tkinter<6>.
traceback
traceback<4>.
types
types<3>.
unicodedata
unicodedata<6>.
unittest
unittest<5>.
unittest.mock
unittest mock<3>.
urllib
wsgiref
xmlrpc
xmlrpc<2>.
xml.sax
xml sax.
zipfile
zipfile<4>.
ssl

Memory BIO Support
Application-Layer Protocol Negotiation Support
Other Changes
Deprecated

New Keywords
New Keywords<2>.
Deprecated Python Behavior
Deprecated Python Behavior<2>.
Unsupported Operating Systems
Deprecated Python modules, functions and methods
Deprecated Python modules functions and methods<3>.
Removed

API and Feature Removals
API and Feature Removals<4>.
Porting to Python 3.5

Changes in Python behavior
Changes in Python behavior<2>.
Changes in the Python API
Changes in the Python API<6>.
Changes in the C API
Changes in the C API<6>.
Notable changes in Python 3.5.4

New make regen-all build target
New make regen-all build target<2>.
Removal of make touch build target
Removal of make touch build target<2>.
What’s New In Python 3.4

Summary – Release Highlights
Summary – Release Highlights<2>.
New Features
New Features<11>.
New Modules
New Modules<8>.
Improved Modules
Improved Modules<8>.
CPython Implementation Changes
Deprecated
Deprecated<9>.
Removed
Removed<9>.
Porting to Python 3.4
Porting to Python 3 4.
Changed in 3.4.3
Changed in 3 4 3.
New Features

PEP 453; Explicit Bootstrapping of PIP in Python Installations
PEP 453 Explicit Bootstrapping of PIP in Python Installations.
PEP 446; Newly Created File Descriptors Are Non-Inheritable
PEP 446 Newly Created File Descriptors Are Non-Inheritable.
Improvements to Codec Handling
PEP 451; A ModuleSpec Type for the Import System
PEP 451 A ModuleSpec Type for the Import System.
Other Language Changes
Other Language Changes<8>.
PEP 453: Explicit Bootstrapping of PIP in Python Installations

Bootstrapping pip By Default
Documentation Changes
New Modules

asyncio
asyncio<9>.
ensurepip
enum
enum<7>.
pathlib
pathlib<8>.
selectors
selectors<2>.
statistics
statistics<4>.
tracemalloc
tracemalloc<4>.
Improved Modules

abc
aifc
aifc<2>.
argparse
argparse<4>.
audioop
base64
base64<2>.
collections
collections<6>.
colorsys
contextlib
contextlib<6>.
dbm
dbm<5>.
dis
dis<2>.
doctest
doctest<3>.
email
email<3>.
filecmp
functools
functools<5>.
gc
gc<5>.
glob
glob<3>.
hashlib
hashlib<5>.
hmac
hmac<3>.
html
http
http<3>.
idlelib and IDLE
idlelib and IDLE<4>.
importlib
importlib<7>.
inspect
inspect<7>.
ipaddress
ipaddress<4>.
logging
logging<6>.
marshal
mmap
mmap<2>.
multiprocessing
multiprocessing<6>.
operator
operator<3>.
os
os<9>.
pdb
pdb<4>.
pickle
pickle<4>.
plistlib
plistlib<2>.
poplib
poplib<3>.
pprint
pprint<4>.
pty
pydoc
pydoc<4>.
re
re<6>.
resource
select
shelve
shelve<2>.
shutil
shutil<4>.
smtpd
smtpd<2>.
smtplib
smtplib<3>.
socket
socket<9>.
sqlite3
sqlite3<6>.
ssl
ssl<8>.
stat
struct
struct<2>.
subprocess
subprocess<4>.
sunau
sunau<2>.
sys
sys<9>.
tarfile
tarfile<3>.
textwrap
threading
threading<6>.
traceback
traceback<5>.
types
types<4>.
urllib
urllib<2>.
unittest
unittest<6>.
venv
venv<6>.
wave
wave<2>.
weakref
weakref<2>.
xml.etree
xml etree<2>.
zipfile
zipfile<5>.
CPython Implementation Changes

PEP 445; Customization of CPython Memory Allocators
PEP 445 Customization of CPython Memory Allocators.
PEP 442; Safe Object Finalization
PEP 442 Safe Object Finalization.
PEP 456; Secure and Interchangeable Hash Algorithm
PEP 456 Secure and Interchangeable Hash Algorithm.
PEP 436; Argument Clinic
PEP 436 Argument Clinic.
Other Build and C API Changes
Other Improvements
Other Improvements<2>.
Significant Optimizations
Deprecated

Deprecations in the Python API
Deprecated Features
Removed

Operating Systems No Longer Supported
API and Feature Removals
API and Feature Removals<5>.
Code Cleanups
Porting to Python 3.4

Changes in ‘python’ Command Behavior
Changes in ‘python’ Command Behavior<2>.
Changes in the Python API
Changes in the Python API<7>.
Changes in the C API
Changes in the C API<7>.
Changed in 3.4.3

PEP 476; Enabling certificate verification by default for stdlib http clients
PEP 476 Enabling certificate verification by default for stdlib http clients.
What’s New In Python 3.3

Summary – Release highlights
Summary – Release highlights<7>.
PEP 405; Virtual Environments
PEP 405 Virtual Environments.
PEP 420; Implicit Namespace Packages
PEP 420 Implicit Namespace Packages.
PEP 3118; New memoryview implementation and buffer protocol documentation
PEP 3118 New memoryview implementation and buffer protocol documentation.
PEP 393; Flexible String Representation
PEP 393 Flexible String Representation.
PEP 397; Python Launcher for Windows
PEP 397 Python Launcher for Windows.
PEP 3151; Reworking the OS and IO exception hierarchy
PEP 3151 Reworking the OS and IO exception hierarchy.
PEP 380; Syntax for Delegating to a Subgenerator
PEP 380 Syntax for Delegating to a Subgenerator.
PEP 409; Suppressing exception context
PEP 409 Suppressing exception context.
PEP 414; Explicit Unicode literals
PEP 414 Explicit Unicode literals.
PEP 3155; Qualified name for classes and functions
PEP 3155 Qualified name for classes and functions.
PEP 412; Key-Sharing Dictionary
PEP 412 Key-Sharing Dictionary.
PEP 362; Function Signature Object
PEP 362 Function Signature Object.
PEP 421; Adding sys.implementation
PEP 421 Adding sys implementation.
Using importlib as the Implementation of Import
Other Language Changes
Other Language Changes<9>.
A Finer-Grained Import Lock
Builtin functions and types
New Modules
New Modules<9>.
Improved Modules
Improved Modules<9>.
Optimizations
Optimizations<8>.
Build and C API Changes
Build and C API Changes<4>.
Deprecated
Deprecated<10>.
Porting to Python 3.3
Porting to Python 3 3.
PEP 3118: New memoryview implementation and buffer protocol documentation

Features
API changes
PEP 393: Flexible String Representation

Functionality
Performance and resource usage
PEP 421: Adding sys.implementation

SimpleNamespace
Using importlib as the Implementation of Import

New APIs
Visible Changes
New Modules

faulthandler
faulthandler<4>.
ipaddress
ipaddress<5>.
lzma
lzma<2>.
Improved Modules

abc
abc<2>.
array
array<3>.
base64
base64<3>.
binascii
binascii<3>.
bz2
bz2<2>.
codecs
codecs<2>.
collections
collections<7>.
contextlib
contextlib<7>.
crypt
crypt<2>.
curses
curses<5>.
datetime
datetime<6>.
decimal
decimal<3>.
email
email<4>.
ftplib
ftplib<2>.
functools
functools<6>.
gc
gc<6>.
hmac
hmac<4>.
http
http<4>.
html
html<2>.
imaplib
imaplib<3>.
inspect
inspect<8>.
io
io<4>.
itertools
itertools<4>.
logging
logging<7>.
math
math<7>.
mmap
mmap<3>.
multiprocessing
multiprocessing<7>.
nntplib
nntplib<2>.
os
os<10>.
pdb
pdb<5>.
pickle
pickle<5>.
pydoc
pydoc<5>.
re
re<7>.
sched
select
select<2>.
shlex
shlex<3>.
shutil
shutil<5>.
signal
signal<4>.
smtpd
smtpd<3>.
smtplib
smtplib<4>.
socket
socket<10>.
socketserver
socketserver<3>.
sqlite3
sqlite3<7>.
ssl
ssl<9>.
stat
stat<2>.
struct
struct<3>.
subprocess
subprocess<5>.
sys
sys<10>.
tarfile
tarfile<4>.
tempfile
tempfile<2>.
textwrap
textwrap<2>.
threading
threading<7>.
time
time<7>.
types
types<5>.
unittest
unittest<7>.
urllib
urllib<3>.
webbrowser
xml.etree.ElementTree
xml etree ElementTree.
zlib
zlib<2>.
decimal

Features
Features<2>.
API changes
API changes<2>.
email

Policy Framework
Provisional Policy with New Header API
Other API Changes
Deprecated

Unsupported Operating Systems
Unsupported Operating Systems<2>.
Deprecated Python modules, functions and methods
Deprecated Python modules functions and methods<4>.
Deprecated functions and types of the C API
Deprecated functions and types of the C API<3>.
Deprecated features
Porting to Python 3.3

Porting Python code
Porting C code
Building C extensions
Command Line Switch Changes
What’s New In Python 3.2

PEP 384; Defining a Stable ABI
PEP 384 Defining a Stable ABI.
PEP 389; Argparse Command Line Parsing Module
PEP 389 Argparse Command Line Parsing Module.
PEP 391; Dictionary Based Configuration for Logging
PEP 391 Dictionary Based Configuration for Logging.
PEP 3148; The concurrent.futures module
PEP 3148 The concurrent futures module.
PEP 3147; PYC Repository Directories
PEP 3147 PYC Repository Directories.
PEP 3149; ABI Version Tagged .so Files
PEP 3149 ABI Version Tagged so Files.
PEP 3333; Python Web Server Gateway Interface v1.0.1
PEP 3333 Python Web Server Gateway Interface v1 0 1.
Other Language Changes
Other Language Changes<10>.
New, Improved, and Deprecated Modules
New Improved and Deprecated Modules.
Multi-threading
Optimizations
Optimizations<9>.
Unicode
Codecs
Documentation
IDLE
Code Repository
Build and C API Changes
Build and C API Changes<5>.
Porting to Python 3.2
Porting to Python 3 2.
New, Improved, and Deprecated Modules

email
email<5>.
elementtree
functools
functools<7>.
itertools
itertools<5>.
collections
collections<8>.
threading
threading<8>.
datetime and time
math
math<8>.
abc
abc<3>.
io
io<5>.
reprlib
logging
logging<8>.
csv
csv<3>.
contextlib
contextlib<8>.
decimal and fractions
ftp
popen
select
select<3>.
gzip and zipfile
tarfile
tarfile<5>.
hashlib
hashlib<6>.
ast
ast<4>.
os
os<11>.
shutil
shutil<6>.
sqlite3
sqlite3<8>.
html
html<3>.
socket
socket<11>.
ssl
ssl<10>.
nntp
certificates
imaplib
imaplib<4>.
http.client
http client<4>.
unittest
unittest<8>.
random
random<3>.
poplib
poplib<4>.
asyncore
asyncore<2>.
tempfile
tempfile<3>.
inspect
inspect<9>.
pydoc
pydoc<6>.
dis
dis<3>.
dbm
dbm<6>.
ctypes
ctypes<2>.
site
site<3>.
sysconfig
sysconfig<3>.
pdb
pdb<6>.
configparser
configparser<2>.
urllib.parse
urllib parse<4>.
mailbox
turtledemo
What’s New In Python 3.1

PEP 372; Ordered Dictionaries
PEP 372 Ordered Dictionaries.
PEP 378; Format Specifier for Thousands Separator
PEP 378 Format Specifier for Thousands Separator.
Other Language Changes
Other Language Changes<11>.
New, Improved, and Deprecated Modules
New Improved and Deprecated Modules<2>.
Optimizations
Optimizations<10>.
IDLE
IDLE<2>.
Build and C API Changes
Build and C API Changes<6>.
Porting to Python 3.1
Porting to Python 3 1.
What’s New In Python 3.0

Common Stumbling Blocks
Overview Of Syntax Changes
Changes Already Present In Python 2.6
Changes Already Present In Python 2 6.
Library Changes
PEP 3101; A New Approach To String Formatting
PEP 3101 A New Approach To String Formatting.
Changes To Exceptions
Miscellaneous Other Changes
Build and C API Changes
Build and C API Changes<7>.
Performance
Porting To Python 3.0
Porting To Python 3 0.
Common Stumbling Blocks

Print Is A Function
Views And Iterators Instead Of Lists
Ordering Comparisons
Integers
Text Vs. Data Instead Of Unicode Vs. 8-bit
Text Vs Data Instead Of Unicode Vs 8-bit.
Overview Of Syntax Changes

New Syntax
Changed Syntax
Removed Syntax
Miscellaneous Other Changes

Operators And Special Methods
Builtins
What’s New in Python 2.7

The Future for Python 2.x
The Future for Python 2 x.
Changes to the Handling of Deprecation Warnings
Python 3.1 Features
Python 3 1 Features.
PEP 372; Adding an Ordered Dictionary to collections
PEP 372 Adding an Ordered Dictionary to collections.
PEP 378; Format Specifier for Thousands Separator
PEP 378 Format Specifier for Thousands Separator<2>.
PEP 389; The argparse Module for Parsing Command Lines
PEP 389 The argparse Module for Parsing Command Lines.
PEP 391; Dictionary-Based Configuration For Logging
PEP 391 Dictionary-Based Configuration For Logging.
PEP 3106; Dictionary Views
PEP 3106 Dictionary Views.
PEP 3137; The memoryview Object
PEP 3137 The memoryview Object.
Other Language Changes
Other Language Changes<12>.
New and Improved Modules
Build and C API Changes
Build and C API Changes<8>.
Other Changes and Fixes
Porting to Python 2.7
Porting to Python 2 7.
New Features Added to Python 2.7 Maintenance Releases
New Features Added to Python 2 7 Maintenance Releases.
Acknowledgements
Other Language Changes

Interpreter Changes
Optimizations
Optimizations<11>.
New and Improved Modules

New module; importlib
New module importlib.
New module; sysconfig
New module sysconfig.
ttk; Themed Widgets for Tk
ttk Themed Widgets for Tk.
Updated module; unittest
Updated module unittest.
Updated module; ElementTree 1.3
Updated module ElementTree 1 3.
Build and C API Changes

Capsules
Port-Specific Changes; Windows
Port-Specific Changes Windows.
Port-Specific Changes; Mac OS X
Port-Specific Changes Mac OS X.
Port-Specific Changes; FreeBSD
Port-Specific Changes FreeBSD.
New Features Added to Python 2.7 Maintenance Releases

Two new environment variables for debug mode
PEP 434; IDLE Enhancement Exception for All Branches
PEP 434 IDLE Enhancement Exception for All Branches.
PEP 466; Network Security Enhancements for Python 2.7
PEP 466 Network Security Enhancements for Python 2 7.
PEP 477; Backport ensurepip (PEP 453) to Python 2.7
PEP 477 Backport ensurepip PEP 453 to Python 2 7.
PEP 476; Enabling certificate verification by default for stdlib http clients
PEP 476 Enabling certificate verification by default for stdlib http clients<2>.
PEP 493; HTTPS verification migration tools for Python 2.7
PEP 493 HTTPS verification migration tools for Python 2 7.
New make regen-all build target
New make regen-all build target<3>.
Removal of make touch build target
Removal of make touch build target<3>.
PEP 477: Backport ensurepip (PEP 453) to Python 2.7

Bootstrapping pip By Default
Bootstrapping pip By Default<2>.
Documentation Changes
Documentation Changes<2>.
What’s New in Python 2.6

Python 3.0
Python 3 0.
Changes to the Development Process
PEP 343; The ‘with’ statement
PEP 343 The ‘with’ statement.
PEP 366; Explicit Relative Imports From a Main Module
PEP 366 Explicit Relative Imports From a Main Module.
PEP 370; Per-user site-packages Directory
PEP 370 Per-user site-packages Directory.
PEP 371; The multiprocessing Package
PEP 371 The multiprocessing Package.
PEP 3101; Advanced String Formatting
PEP 3101 Advanced String Formatting.
PEP 3105; print As a Function
PEP 3105 print As a Function.
PEP 3110; Exception-Handling Changes
PEP 3110 Exception-Handling Changes.
PEP 3112; Byte Literals
PEP 3112 Byte Literals.
PEP 3116; New I/O Library
PEP 3116 New I/O Library.
PEP 3118; Revised Buffer Protocol
PEP 3118 Revised Buffer Protocol.
PEP 3119; Abstract Base Classes
PEP 3119 Abstract Base Classes.
PEP 3127; Integer Literal Support and Syntax
PEP 3127 Integer Literal Support and Syntax.
PEP 3129; Class Decorators
PEP 3129 Class Decorators.
PEP 3141; A Type Hierarchy for Numbers
PEP 3141 A Type Hierarchy for Numbers.
Other Language Changes
Other Language Changes<13>.
New and Improved Modules
New and Improved Modules<2>.
Deprecations and Removals
Build and C API Changes
Build and C API Changes<9>.
Porting to Python 2.6
Porting to Python 2 6.
Acknowledgements
Acknowledgements<2>.
Changes to the Development Process

New Issue Tracker; Roundup
New Issue Tracker Roundup.
New Documentation Format; reStructuredText Using Sphinx
New Documentation Format reStructuredText Using Sphinx.
PEP 343: The ‘with’ statement

Writing Context Managers
The contextlib module
PEP 3141: A Type Hierarchy for Numbers

The fractions Module
Other Language Changes

Optimizations
Optimizations<12>.
Interpreter Changes
Interpreter Changes<2>.
New and Improved Modules

The ast module
The future_builtins module
The json module; JavaScript Object Notation
The json module JavaScript Object Notation.
The plistlib module; A Property-List Parser
The plistlib module A Property-List Parser.
ctypes Enhancements
Improved SSL Support
Build and C API Changes

Port-Specific Changes; Windows
Port-Specific Changes Windows<2>.
Port-Specific Changes; Mac OS X
Port-Specific Changes Mac OS X<2>.
Port-Specific Changes; IRIX
Port-Specific Changes IRIX.
What’s New in Python 2.5

PEP 308; Conditional Expressions
PEP 308 Conditional Expressions.
PEP 309; Partial Function Application
PEP 309 Partial Function Application.
PEP 314; Metadata for Python Software Packages v1.1
PEP 314 Metadata for Python Software Packages v1 1.
PEP 328; Absolute and Relative Imports
PEP 328 Absolute and Relative Imports.
PEP 338; Executing Modules as Scripts
PEP 338 Executing Modules as Scripts.
PEP 341; Unified try/except/finally
PEP 341 Unified try/except/finally.
PEP 342; New Generator Features
PEP 342 New Generator Features.
PEP 343; The ‘with’ statement
PEP 343 The ‘with’ statement<2>.
PEP 352; Exceptions as New-Style Classes
PEP 352 Exceptions as New-Style Classes.
PEP 353; Using ssize_t as the index type
PEP 353 Using ssize_t as the index type.
PEP 357; The ‘__index__’ method
PEP 357 The ‘__index__’ method.
Other Language Changes
Other Language Changes<14>.
New, Improved, and Removed Modules
New Improved and Removed Modules.
Build and C API Changes
Build and C API Changes<10>.
Porting to Python 2.5
Porting to Python 2 5.
Acknowledgements
Acknowledgements<3>.
PEP 343: The ‘with’ statement

Writing Context Managers
Writing Context Managers<2>.
The contextlib module
The contextlib module<2>.
Other Language Changes

Interactive Interpreter Changes
Optimizations
Optimizations<13>.
New, Improved, and Removed Modules

The ctypes package
The ElementTree package
The hashlib package
The sqlite3 package
The wsgiref package
Build and C API Changes

Port-Specific Changes
What’s New in Python 2.4

PEP 218; Built-In Set Objects
PEP 218 Built-In Set Objects.
PEP 237; Unifying Long Integers and Integers
PEP 237 Unifying Long Integers and Integers.
PEP 289; Generator Expressions
PEP 289 Generator Expressions.
PEP 292; Simpler String Substitutions
PEP 292 Simpler String Substitutions.
PEP 318; Decorators for Functions and Methods
PEP 318 Decorators for Functions and Methods.
PEP 322; Reverse Iteration
PEP 322 Reverse Iteration.
PEP 324; New subprocess Module
PEP 324 New subprocess Module.
PEP 327; Decimal Data Type
PEP 327 Decimal Data Type.
PEP 328; Multi-line Imports
PEP 328 Multi-line Imports.
PEP 331; Locale-Independent Float/String Conversions
PEP 331 Locale-Independent Float/String Conversions.
Other Language Changes
Other Language Changes<15>.
New, Improved, and Deprecated Modules
New Improved and Deprecated Modules<3>.
Build and C API Changes
Build and C API Changes<11>.
Porting to Python 2.4
Porting to Python 2 4.
Acknowledgements
Acknowledgements<4>.
PEP 327: Decimal Data Type

Why is Decimal needed?
The Decimal type
The Context type
Other Language Changes

Optimizations
Optimizations<14>.
New, Improved, and Deprecated Modules

cookielib
doctest
doctest<4>.
Build and C API Changes

Port-Specific Changes
Port-Specific Changes<2>.
What’s New in Python 2.3

PEP 218; A Standard Set Datatype
PEP 218 A Standard Set Datatype.
PEP 255; Simple Generators
PEP 255 Simple Generators.
PEP 263; Source Code Encodings
PEP 263 Source Code Encodings.
PEP 273; Importing Modules from ZIP Archives
PEP 273 Importing Modules from ZIP Archives.
PEP 277; Unicode file name support for Windows NT
PEP 277 Unicode file name support for Windows NT.
PEP 278; Universal Newline Support
PEP 278 Universal Newline Support.
PEP 279; enumerate()
PEP 279 enumerate.
PEP 282; The logging Package
PEP 282 The logging Package.
PEP 285; A Boolean Type
PEP 285 A Boolean Type.
PEP 293; Codec Error Handling Callbacks
PEP 293 Codec Error Handling Callbacks.
PEP 301; Package Index and Metadata for Distutils
PEP 301 Package Index and Metadata for Distutils.
PEP 302; New Import Hooks
PEP 302 New Import Hooks.
PEP 305; Comma-separated Files
PEP 305 Comma-separated Files.
PEP 307; Pickle Enhancements
PEP 307 Pickle Enhancements.
Extended Slices
Other Language Changes
Other Language Changes<16>.
New, Improved, and Deprecated Modules
New Improved and Deprecated Modules<4>.
Pymalloc; A Specialized Object Allocator
Pymalloc A Specialized Object Allocator.
Build and C API Changes
Build and C API Changes<12>.
Other Changes and Fixes
Other Changes and Fixes<2>.
Porting to Python 2.3
Porting to Python 2 3.
Acknowledgements
Acknowledgements<5>.
Other Language Changes

String Changes
Optimizations
Optimizations<15>.
New, Improved, and Deprecated Modules

Date/Time Type
The optparse Module
Build and C API Changes

Port-Specific Changes
Port-Specific Changes<3>.
What’s New in Python 2.2

Introduction
PEPs 252 and 253; Type and Class Changes
PEPs 252 and 253 Type and Class Changes.
PEP 234; Iterators
PEP 234 Iterators.
PEP 255; Simple Generators
PEP 255 Simple Generators<2>.
PEP 237; Unifying Long Integers and Integers
PEP 237 Unifying Long Integers and Integers<2>.
PEP 238; Changing the Division Operator
PEP 238 Changing the Division Operator.
Unicode Changes
PEP 227; Nested Scopes
PEP 227 Nested Scopes.
New and Improved Modules
New and Improved Modules<3>.
Interpreter Changes and Fixes
Other Changes and Fixes
Other Changes and Fixes<3>.
Acknowledgements
Acknowledgements<6>.
PEPs 252 and 253: Type and Class Changes

Old and New Classes
Descriptors
Multiple Inheritance; The Diamond Rule
Multiple Inheritance The Diamond Rule.
Attribute Access
Related Links
What’s New in Python 2.1

Introduction
Introduction<2>.
PEP 227; Nested Scopes
PEP 227 Nested Scopes<2>.
PEP 236; __future__ Directives
PEP 236 __future__ Directives.
PEP 207; Rich Comparisons
PEP 207 Rich Comparisons.
PEP 230; Warning Framework
PEP 230 Warning Framework.
PEP 229; New Build System
PEP 229 New Build System.
PEP 205; Weak References
PEP 205 Weak References.
PEP 232; Function Attributes
PEP 232 Function Attributes.
PEP 235; Importing Modules on Case-Insensitive Platforms
PEP 235 Importing Modules on Case-Insensitive Platforms.
PEP 217; Interactive Display Hook
PEP 217 Interactive Display Hook.
PEP 208; New Coercion Model
PEP 208 New Coercion Model.
PEP 241; Metadata in Python Packages
PEP 241 Metadata in Python Packages.
New and Improved Modules
New and Improved Modules<4>.
Other Changes and Fixes
Other Changes and Fixes<4>.
Acknowledgements
Acknowledgements<7>.
What’s New in Python 2.0

Introduction
Introduction<3>.
What About Python 1.6?
What About Python 1 6?.
New Development Process
Unicode
Unicode<2>.
List Comprehensions
Augmented Assignment
String Methods
Garbage Collection of Cycles
Other Core Changes
Porting to 2.0
Porting to 2 0.
Extending/Embedding Changes
Distutils; Making Modules Easy to Install
Distutils Making Modules Easy to Install.
XML Modules
Module changes
New modules
IDLE Improvements
Deleted and Deprecated Modules
Acknowledgements
Acknowledgements<8>.
Other Core Changes

Minor Language Changes
Changes to Built-in Functions
XML Modules

SAX2 Support
DOM Support
Relationship to PyXML
Changelog

Python 3.11.2 final
Python 3 11 2 final.
Python 3.11.1 final
Python 3 11 1 final.
Python 3.11.0 final
Python 3 11 0 final.
Python 3.11.0 release candidate 2
Python 3 11 0 release candidate 2.
Python 3.11.0 release candidate 1
Python 3 11 0 release candidate 1.
Python 3.11.0 beta 5
Python 3 11 0 beta 5.
Python 3.11.0 beta 4
Python 3 11 0 beta 4.
Python 3.11.0 beta 3
Python 3 11 0 beta 3.
Python 3.11.0 beta 2
Python 3 11 0 beta 2.
Python 3.11.0 beta 1
Python 3 11 0 beta 1.
Python 3.11.0 alpha 7
Python 3 11 0 alpha 7.
Python 3.11.0 alpha 6
Python 3 11 0 alpha 6.
Python 3.11.0 alpha 5
Python 3 11 0 alpha 5.
Python 3.11.0 alpha 4
Python 3 11 0 alpha 4.
Python 3.11.0 alpha 3
Python 3 11 0 alpha 3.
Python 3.11.0 alpha 2
Python 3 11 0 alpha 2.
Python 3.11.0 alpha 1
Python 3 11 0 alpha 1.
Python 3.10.0 beta 1
Python 3 10 0 beta 1.
Python 3.10.0 alpha 7
Python 3 10 0 alpha 7.
Python 3.10.0 alpha 6
Python 3 10 0 alpha 6.
Python 3.10.0 alpha 5
Python 3 10 0 alpha 5.
Python 3.10.0 alpha 4
Python 3 10 0 alpha 4.
Python 3.10.0 alpha 3
Python 3 10 0 alpha 3.
Python 3.10.0 alpha 2
Python 3 10 0 alpha 2.
Python 3.10.0 alpha 1
Python 3 10 0 alpha 1.
Python 3.9.0 beta 1
Python 3 9 0 beta 1.
Python 3.9.0 alpha 6
Python 3 9 0 alpha 6.
Python 3.9.0 alpha 5
Python 3 9 0 alpha 5.
Python 3.9.0 alpha 4
Python 3 9 0 alpha 4.
Python 3.9.0 alpha 3
Python 3 9 0 alpha 3.
Python 3.9.0 alpha 2
Python 3 9 0 alpha 2.
Python 3.9.0 alpha 1
Python 3 9 0 alpha 1.
Python 3.8.0 beta 1
Python 3 8 0 beta 1.
Python 3.8.0 alpha 4
Python 3 8 0 alpha 4.
Python 3.8.0 alpha 3
Python 3 8 0 alpha 3.
Python 3.8.0 alpha 2
Python 3 8 0 alpha 2.
Python 3.8.0 alpha 1
Python 3 8 0 alpha 1.
Python 3.7.0 final
Python 3 7 0 final.
Python 3.7.0 release candidate 1
Python 3 7 0 release candidate 1.
Python 3.7.0 beta 5
Python 3 7 0 beta 5.
Python 3.7.0 beta 4
Python 3 7 0 beta 4.
Python 3.7.0 beta 3
Python 3 7 0 beta 3.
Python 3.7.0 beta 2
Python 3 7 0 beta 2.
Python 3.7.0 beta 1
Python 3 7 0 beta 1.
Python 3.7.0 alpha 4
Python 3 7 0 alpha 4.
Python 3.7.0 alpha 3
Python 3 7 0 alpha 3.
Python 3.7.0 alpha 2
Python 3 7 0 alpha 2.
Python 3.7.0 alpha 1
Python 3 7 0 alpha 1.
Python 3.6.6 final
Python 3 6 6 final.
Python 3.6.6 release candidate 1
Python 3 6 6 release candidate 1.
Python 3.6.5 final
Python 3 6 5 final.
Python 3.6.5 release candidate 1
Python 3 6 5 release candidate 1.
Python 3.6.4 final
Python 3 6 4 final.
Python 3.6.4 release candidate 1
Python 3 6 4 release candidate 1.
Python 3.6.3 final
Python 3 6 3 final.
Python 3.6.3 release candidate 1
Python 3 6 3 release candidate 1.
Python 3.6.2 final
Python 3 6 2 final.
Python 3.6.2 release candidate 2
Python 3 6 2 release candidate 2.
Python 3.6.2 release candidate 1
Python 3 6 2 release candidate 1.
Python 3.6.1 final
Python 3 6 1 final.
Python 3.6.1 release candidate 1
Python 3 6 1 release candidate 1.
Python 3.6.0 final
Python 3 6 0 final.
Python 3.6.0 release candidate 2
Python 3 6 0 release candidate 2.
Python 3.6.0 release candidate 1
Python 3 6 0 release candidate 1.
Python 3.6.0 beta 4
Python 3 6 0 beta 4.
Python 3.6.0 beta 3
Python 3 6 0 beta 3.
Python 3.6.0 beta 2
Python 3 6 0 beta 2.
Python 3.6.0 beta 1
Python 3 6 0 beta 1.
Python 3.6.0 alpha 4
Python 3 6 0 alpha 4.
Python 3.6.0 alpha 3
Python 3 6 0 alpha 3.
Python 3.6.0 alpha 2
Python 3 6 0 alpha 2.
Python 3.6.0 alpha 1
Python 3 6 0 alpha 1.
Python 3.5.5 final
Python 3 5 5 final.
Python 3.5.5 release candidate 1
Python 3 5 5 release candidate 1.
Python 3.5.4 final
Python 3 5 4 final.
Python 3.5.4 release candidate 1
Python 3 5 4 release candidate 1.
Python 3.5.3 final
Python 3 5 3 final.
Python 3.5.3 release candidate 1
Python 3 5 3 release candidate 1.
Python 3.5.2 final
Python 3 5 2 final.
Python 3.5.2 release candidate 1
Python 3 5 2 release candidate 1.
Python 3.5.1 final
Python 3 5 1 final.
Python 3.5.1 release candidate 1
Python 3 5 1 release candidate 1.
Python 3.5.0 final
Python 3 5 0 final.
Python 3.5.0 release candidate 4
Python 3 5 0 release candidate 4.
Python 3.5.0 release candidate 3
Python 3 5 0 release candidate 3.
Python 3.5.0 release candidate 2
Python 3 5 0 release candidate 2.
Python 3.5.0 release candidate 1
Python 3 5 0 release candidate 1.
Python 3.5.0 beta 4
Python 3 5 0 beta 4.
Python 3.5.0 beta 3
Python 3 5 0 beta 3.
Python 3.5.0 beta 2
Python 3 5 0 beta 2.
Python 3.5.0 beta 1
Python 3 5 0 beta 1.
Python 3.5.0 alpha 4
Python 3 5 0 alpha 4.
Python 3.5.0 alpha 3
Python 3 5 0 alpha 3.
Python 3.5.0 alpha 2
Python 3 5 0 alpha 2.
Python 3.5.0 alpha 1
Python 3 5 0 alpha 1.
Python 3.11.2 final

Core and Builtins
Library
Documentation
Documentation<2>.
Tests
Build
Windows
macOS
Tools/Demos
C API
Python 3.11.1 final

Security
Core and Builtins
Core and Builtins<2>.
Library
Library<2>.
Documentation
Documentation<3>.
Tests
Tests<2>.
Build
Build<2>.
Windows
Windows<2>.
macOS
macOS<2>.
IDLE
IDLE<3>.
Tools/Demos
Tools/Demos<2>.
C API
C API<2>.
Python 3.11.0 final

Security
Security<2>.
Core and Builtins
Core and Builtins<3>.
Library
Library<3>.
Documentation
Documentation<4>.
Tests
Tests<3>.
Build
Build<3>.
Windows
Windows<3>.
macOS
macOS<3>.
Python 3.11.0 release candidate 2

Security
Security<3>.
Core and Builtins
Core and Builtins<4>.
Library
Library<4>.
Documentation
Documentation<5>.
Tests
Tests<4>.
Build
Build<4>.
Windows
Windows<4>.
Python 3.11.0 release candidate 1

Core and Builtins
Core and Builtins<5>.
Library
Library<5>.
Documentation
Documentation<6>.
Tests
Tests<5>.
Build
Build<5>.
Windows
Windows<5>.
IDLE
IDLE<4>.
C API
C API<3>.
Python 3.11.0 beta 5

Core and Builtins
Core and Builtins<6>.
Library
Library<6>.
Tests
Tests<6>.
Build
Build<6>.
Windows
Windows<6>.
C API
C API<4>.
Python 3.11.0 beta 4

Security
Security<4>.
Core and Builtins
Core and Builtins<7>.
Library
Library<7>.
Documentation
Documentation<7>.
Tests
Tests<7>.
Build
Build<7>.
Windows
Windows<7>.
Tools/Demos
Tools/Demos<3>.
C API
C API<5>.
Python 3.11.0 beta 3

Core and Builtins
Core and Builtins<8>.
Build
Build<8>.
Python 3.11.0 beta 2

Core and Builtins
Core and Builtins<9>.
Library
Library<8>.
Documentation
Documentation<8>.
Tests
Tests<8>.
Build
Build<9>.
Windows
Windows<8>.
C API
C API<6>.
Python 3.11.0 beta 1

Security
Security<5>.
Core and Builtins
Core and Builtins<10>.
Library
Library<9>.
Documentation
Documentation<9>.
Tests
Tests<9>.
Build
Build<10>.
Windows
Windows<9>.
macOS
macOS<4>.
Tools/Demos
Tools/Demos<4>.
C API
C API<7>.
Python 3.11.0 alpha 7

Core and Builtins
Core and Builtins<11>.
Library
Library<10>.
Documentation
Documentation<10>.
Tests
Tests<10>.
Build
Build<11>.
Windows
Windows<10>.
macOS
macOS<5>.
Tools/Demos
Tools/Demos<5>.
C API
C API<8>.
Python 3.11.0 alpha 6

Core and Builtins
Core and Builtins<12>.
Library
Library<11>.
Documentation
Documentation<11>.
Tests
Tests<11>.
Build
Build<12>.
Windows
Windows<11>.
IDLE
IDLE<5>.
C API
C API<9>.
Python 3.11.0 alpha 5

Core and Builtins
Core and Builtins<13>.
Library
Library<12>.
Documentation
Documentation<12>.
Tests
Tests<12>.
Build
Build<13>.
Windows
Windows<12>.
macOS
macOS<6>.
IDLE
IDLE<6>.
C API
C API<10>.
Python 3.11.0 alpha 4

Core and Builtins
Core and Builtins<14>.
Library
Library<13>.
Documentation
Documentation<13>.
Tests
Tests<13>.
Build
Build<14>.
Windows
Windows<13>.
macOS
macOS<7>.
C API
C API<11>.
Python 3.11.0 alpha 3

Core and Builtins
Core and Builtins<15>.
Library
Library<14>.
Documentation
Documentation<14>.
Tests
Tests<14>.
Build
Build<15>.
Windows
Windows<14>.
macOS
macOS<8>.
C API
C API<12>.
Python 3.11.0 alpha 2

Core and Builtins
Core and Builtins<16>.
Library
Library<15>.
Documentation
Documentation<15>.
Tests
Tests<15>.
Build
Build<16>.
Windows
Windows<15>.
macOS
macOS<9>.
IDLE
IDLE<7>.
C API
C API<13>.
Python 3.11.0 alpha 1

Security
Security<6>.
Core and Builtins
Core and Builtins<17>.
Library
Library<16>.
Documentation
Documentation<16>.
Tests
Tests<16>.
Build
Build<17>.
Windows
Windows<16>.
macOS
macOS<10>.
IDLE
IDLE<8>.
Tools/Demos
Tools/Demos<6>.
C API
C API<14>.
Python 3.10.0 beta 1

Security
Security<7>.
Core and Builtins
Core and Builtins<18>.
Library
Library<17>.
Documentation
Documentation<17>.
Tests
Tests<17>.
Build
Build<18>.
Windows
Windows<17>.
macOS
macOS<11>.
IDLE
IDLE<9>.
C API
C API<15>.
Python 3.10.0 alpha 7

Security
Security<8>.
Core and Builtins
Core and Builtins<19>.
Library
Library<18>.
Documentation
Documentation<18>.
Tests
Tests<18>.
Build
Build<19>.
Windows
Windows<18>.
IDLE
IDLE<10>.
C API
C API<16>.
Python 3.10.0 alpha 6

Security
Security<9>.
Core and Builtins
Core and Builtins<20>.
Library
Library<19>.
Documentation
Documentation<19>.
Tests
Tests<19>.
Build
Build<20>.
Windows
Windows<19>.
macOS
macOS<12>.
IDLE
IDLE<11>.
C API
C API<17>.
Python 3.10.0 alpha 5

Security
Security<10>.
Core and Builtins
Core and Builtins<21>.
Library
Library<20>.
Documentation
Documentation<20>.
Tests
Tests<20>.
Build
Build<21>.
Windows
Windows<20>.
macOS
macOS<13>.
IDLE
IDLE<12>.
C API
C API<18>.
Python 3.10.0 alpha 4

Core and Builtins
Core and Builtins<22>.
Library
Library<21>.
Documentation
Documentation<21>.
Tests
Tests<21>.
Build
Build<22>.
macOS
macOS<14>.
Tools/Demos
Tools/Demos<7>.
C API
C API<19>.
Python 3.10.0 alpha 3

Security
Security<11>.
Core and Builtins
Core and Builtins<23>.
Library
Library<22>.
Documentation
Documentation<22>.
Tests
Tests<22>.
Build
Build<23>.
Windows
Windows<21>.
macOS
macOS<15>.
IDLE
IDLE<13>.
Tools/Demos
Tools/Demos<8>.
C API
C API<20>.
Python 3.10.0 alpha 2

Security
Security<12>.
Core and Builtins
Core and Builtins<24>.
Library
Library<23>.
Documentation
Documentation<23>.
Tests
Tests<23>.
Build
Build<24>.
Windows
Windows<22>.
macOS
macOS<16>.
IDLE
IDLE<14>.
C API
C API<21>.
Python 3.10.0 alpha 1

Security
Security<13>.
Core and Builtins
Core and Builtins<25>.
Library
Library<24>.
Documentation
Documentation<24>.
Tests
Tests<24>.
Build
Build<25>.
Windows
Windows<23>.
macOS
macOS<17>.
IDLE
IDLE<15>.
C API
C API<22>.
Python 3.9.0 beta 1

Security
Security<14>.
Core and Builtins
Core and Builtins<26>.
Library
Library<25>.
Documentation
Documentation<25>.
Tests
Tests<25>.
Build
Build<26>.
Windows
Windows<24>.
macOS
macOS<18>.
Tools/Demos
Tools/Demos<9>.
C API
C API<23>.
Python 3.9.0 alpha 6

Security
Security<15>.
Core and Builtins
Core and Builtins<27>.
Library
Library<26>.
Documentation
Documentation<26>.
Tests
Tests<26>.
Build
Build<27>.
Windows
Windows<25>.
macOS
macOS<19>.
IDLE
IDLE<16>.
Tools/Demos
Tools/Demos<10>.
C API
C API<24>.
Python 3.9.0 alpha 5

Security
Security<16>.
Core and Builtins
Core and Builtins<28>.
Library
Library<27>.
Documentation
Documentation<27>.
Tests
Tests<27>.
Build
Build<28>.
Windows
Windows<26>.
macOS
macOS<20>.
IDLE
IDLE<17>.
Tools/Demos
Tools/Demos<11>.
C API
C API<25>.
Python 3.9.0 alpha 4

Security
Security<17>.
Core and Builtins
Core and Builtins<29>.
Library
Library<28>.
Documentation
Documentation<28>.
Tests
Tests<28>.
Build
Build<29>.
Windows
Windows<27>.
IDLE
IDLE<18>.
C API
C API<26>.
Python 3.9.0 alpha 3

Core and Builtins
Core and Builtins<30>.
Library
Library<29>.
Documentation
Documentation<29>.
Build
Build<30>.
IDLE
IDLE<19>.
C API
C API<27>.
Python 3.9.0 alpha 2

Security
Security<18>.
Core and Builtins
Core and Builtins<31>.
Library
Library<30>.
Documentation
Documentation<30>.
Tests
Tests<29>.
Build
Build<31>.
Windows
Windows<28>.
macOS
macOS<21>.
IDLE
IDLE<20>.
C API
C API<28>.
Python 3.9.0 alpha 1

Security
Security<19>.
Core and Builtins
Core and Builtins<32>.
Library
Library<31>.
Documentation
Documentation<31>.
Tests
Tests<30>.
Build
Build<32>.
Windows
Windows<29>.
macOS
macOS<22>.
IDLE
IDLE<21>.
Tools/Demos
Tools/Demos<12>.
C API
C API<29>.
Python 3.8.0 beta 1

Security
Security<20>.
Core and Builtins
Core and Builtins<33>.
Library
Library<32>.
Documentation
Documentation<32>.
Tests
Tests<31>.
Build
Build<33>.
Windows
Windows<30>.
macOS
macOS<23>.
IDLE
IDLE<22>.
Tools/Demos
Tools/Demos<13>.
C API
C API<30>.
Python 3.8.0 alpha 4

Security
Security<21>.
Core and Builtins
Core and Builtins<34>.
Library
Library<33>.
Documentation
Documentation<33>.
Tests
Tests<32>.
Build
Build<34>.
Windows
Windows<31>.
macOS
macOS<24>.
IDLE
IDLE<23>.
Tools/Demos
Tools/Demos<14>.
C API
C API<31>.
Python 3.8.0 alpha 3

Security
Security<22>.
Core and Builtins
Core and Builtins<35>.
Library
Library<34>.
Documentation
Documentation<34>.
Tests
Tests<33>.
Build
Build<35>.
Windows
Windows<32>.
IDLE
IDLE<24>.
Tools/Demos
Tools/Demos<15>.
C API
C API<32>.
Python 3.8.0 alpha 2

Core and Builtins
Core and Builtins<36>.
Library
Library<35>.
Documentation
Documentation<35>.
Tests
Tests<34>.
Windows
Windows<33>.
IDLE
IDLE<25>.
Python 3.8.0 alpha 1

Security
Security<23>.
Core and Builtins
Core and Builtins<37>.
Library
Library<36>.
Documentation
Documentation<36>.
Tests
Tests<35>.
Build
Build<36>.
Windows
Windows<34>.
macOS
macOS<25>.
IDLE
IDLE<26>.
Tools/Demos
Tools/Demos<16>.
C API
C API<33>.
Python 3.7.0 final

Library
Library<37>.
C API
C API<34>.
Python 3.7.0 release candidate 1

Core and Builtins
Core and Builtins<38>.
Library
Library<38>.
Documentation
Documentation<37>.
Build
Build<37>.
Windows
Windows<35>.
IDLE
IDLE<27>.
Python 3.7.0 beta 5

Core and Builtins
Core and Builtins<39>.
Library
Library<39>.
Documentation
Documentation<38>.
Tests
Tests<36>.
Build
Build<38>.
macOS
macOS<26>.
IDLE
IDLE<28>.
Python 3.7.0 beta 4

Core and Builtins
Core and Builtins<40>.
Library
Library<40>.
Documentation
Documentation<39>.
Tests
Tests<37>.
Build
Build<39>.
Windows
Windows<36>.
macOS
macOS<27>.
IDLE
IDLE<29>.
Tools/Demos
Tools/Demos<17>.
Python 3.7.0 beta 3

Security
Security<24>.
Core and Builtins
Core and Builtins<41>.
Library
Library<41>.
Documentation
Documentation<40>.
Tests
Tests<38>.
Build
Build<40>.
Windows
Windows<37>.
macOS
macOS<28>.
IDLE
IDLE<30>.
Tools/Demos
Tools/Demos<18>.
C API
C API<35>.
Python 3.7.0 beta 2

Security
Security<25>.
Core and Builtins
Core and Builtins<42>.
Library
Library<42>.
Documentation
Documentation<41>.
Tests
Tests<39>.
Build
Build<41>.
Windows
Windows<38>.
macOS
macOS<29>.
IDLE
IDLE<31>.
Tools/Demos
Tools/Demos<19>.
Python 3.7.0 beta 1

Core and Builtins
Core and Builtins<43>.
Library
Library<43>.
Documentation
Documentation<42>.
Tests
Tests<40>.
Build
Build<42>.
Windows
Windows<39>.
macOS
macOS<30>.
C API
C API<36>.
Python 3.7.0 alpha 4

Core and Builtins
Core and Builtins<44>.
Library
Library<44>.
Documentation
Documentation<43>.
Tests
Tests<41>.
Windows
Windows<40>.
Tools/Demos
Tools/Demos<20>.
C API
C API<37>.
Python 3.7.0 alpha 3

Core and Builtins
Core and Builtins<45>.
Library
Library<45>.
Documentation
Documentation<44>.
Tests
Tests<42>.
Build
Build<43>.
Windows
Windows<41>.
macOS
macOS<31>.
IDLE
IDLE<32>.
Tools/Demos
Tools/Demos<21>.
C API
C API<38>.
Python 3.7.0 alpha 2

Core and Builtins
Core and Builtins<46>.
Library
Library<46>.
Documentation
Documentation<45>.
Build
Build<44>.
IDLE
IDLE<33>.
C API
C API<39>.
Python 3.7.0 alpha 1

Security
Security<26>.
Core and Builtins
Core and Builtins<47>.
Library
Library<47>.
Documentation
Documentation<46>.
Tests
Tests<43>.
Build
Build<45>.
Windows
Windows<42>.
IDLE
IDLE<34>.
Tools/Demos
Tools/Demos<22>.
C API
C API<40>.
Python 3.6.6 release candidate 1

Core and Builtins
Core and Builtins<48>.
Library
Library<48>.
Documentation
Documentation<47>.
Tests
Tests<44>.
Build
Build<46>.
Windows
Windows<43>.
macOS
macOS<32>.
IDLE
IDLE<35>.
Tools/Demos
Tools/Demos<23>.
C API
C API<41>.
Python 3.6.5 final

Tests
Tests<45>.
Build
Build<47>.
Python 3.6.5 release candidate 1

Security
Security<27>.
Core and Builtins
Core and Builtins<49>.
Library
Library<49>.
Documentation
Documentation<48>.
Tests
Tests<46>.
Build
Build<48>.
Windows
Windows<44>.
macOS
macOS<33>.
IDLE
IDLE<36>.
Tools/Demos
Tools/Demos<24>.
C API
C API<42>.
Python 3.6.4 release candidate 1

Core and Builtins
Core and Builtins<50>.
Library
Library<50>.
Documentation
Documentation<49>.
Tests
Tests<47>.
Build
Build<49>.
Windows
Windows<45>.
macOS
macOS<34>.
IDLE
IDLE<37>.
Tools/Demos
Tools/Demos<25>.
C API
C API<43>.
Python 3.6.3 final

Library
Library<51>.
Build
Build<50>.
Python 3.6.3 release candidate 1

Security
Security<28>.
Core and Builtins
Core and Builtins<51>.
Library
Library<52>.
Documentation
Documentation<50>.
Tests
Tests<48>.
Build
Build<51>.
Windows
Windows<46>.
IDLE
IDLE<38>.
Tools/Demos
Tools/Demos<26>.
Python 3.6.2 release candidate 2

Security
Security<29>.
Python 3.6.2 release candidate 1

Security
Security<30>.
Core and Builtins
Core and Builtins<52>.
Library
Library<53>.
IDLE
IDLE<39>.
C API
C API<44>.
Build
Build<52>.
Documentation
Documentation<51>.
Tools/Demos
Tools/Demos<27>.
Tests
Tests<49>.
Windows
Windows<47>.
Python 3.6.1 final

Core and Builtins
Core and Builtins<53>.
Build
Build<53>.
Python 3.6.1 release candidate 1

Core and Builtins
Core and Builtins<54>.
Library
Library<54>.
IDLE
IDLE<40>.
Windows
Windows<48>.
C API
C API<45>.
Documentation
Documentation<52>.
Tests
Tests<50>.
Build
Build<54>.
Python 3.6.0 release candidate 2

Core and Builtins
Core and Builtins<55>.
Tools/Demos
Tools/Demos<28>.
Windows
Windows<49>.
Build
Build<55>.
Python 3.6.0 release candidate 1

Core and Builtins
Core and Builtins<56>.
Library
Library<55>.
C API
C API<46>.
Documentation
Documentation<53>.
Tools/Demos
Tools/Demos<29>.
Python 3.6.0 beta 4

Core and Builtins
Core and Builtins<57>.
Library
Library<56>.
Documentation
Documentation<54>.
Tests
Tests<51>.
Build
Build<56>.
Python 3.6.0 beta 3

Core and Builtins
Core and Builtins<58>.
Library
Library<57>.
Windows
Windows<50>.
Build
Build<57>.
Tests
Tests<52>.
Python 3.6.0 beta 2

Core and Builtins
Core and Builtins<59>.
Library
Library<58>.
Windows
Windows<51>.
C API
C API<47>.
Build
Build<58>.
Tests
Tests<53>.
Python 3.6.0 beta 1

Core and Builtins
Core and Builtins<60>.
Library
Library<59>.
IDLE
IDLE<41>.
C API
C API<48>.
Tests
Tests<54>.
Build
Build<59>.
Tools/Demos
Tools/Demos<30>.
Windows
Windows<52>.
Python 3.6.0 alpha 4

Core and Builtins
Core and Builtins<61>.
Library
Library<60>.
IDLE
IDLE<42>.
Tests
Tests<55>.
Windows
Windows<53>.
Build
Build<60>.
Python 3.6.0 alpha 3

Security
Security<31>.
Core and Builtins
Core and Builtins<62>.
Library
Library<61>.
IDLE
IDLE<43>.
C API
C API<49>.
Build
Build<61>.
Tools/Demos
Tools/Demos<31>.
Documentation
Documentation<55>.
Tests
Tests<56>.
Python 3.6.0 alpha 2

Security
Security<32>.
Core and Builtins
Core and Builtins<63>.
Library
Library<62>.
IDLE
IDLE<44>.
Documentation
Documentation<56>.
Tests
Tests<57>.
Windows
Windows<54>.
Build
Build<62>.
C API
C API<50>.
Tools/Demos
Tools/Demos<32>.
Python 3.6.0 alpha 1

Security
Security<33>.
Core and Builtins
Core and Builtins<64>.
Library
Library<63>.
IDLE
IDLE<45>.
Documentation
Documentation<57>.
Tests
Tests<58>.
Build
Build<63>.
Windows
Windows<55>.
Tools/Demos
Tools/Demos<33>.
C API
C API<51>.
Python 3.5.5 release candidate 1

Security
Security<34>.
Core and Builtins
Core and Builtins<65>.
Library
Library<64>.
Python 3.5.4 final

Library
Library<65>.
Python 3.5.4 release candidate 1

Security
Security<35>.
Core and Builtins
Core and Builtins<66>.
Library
Library<66>.
Documentation
Documentation<58>.
Tests
Tests<59>.
Build
Build<64>.
Windows
Windows<56>.
C API
C API<52>.
Python 3.5.3 release candidate 1

Security
Security<36>.
Core and Builtins
Core and Builtins<67>.
Library
Library<67>.
IDLE
IDLE<46>.
C API
C API<53>.
Documentation
Documentation<59>.
Tests
Tests<60>.
Tools/Demos
Tools/Demos<34>.
Windows
Windows<57>.
Build
Build<65>.
Python 3.5.2 final

Core and Builtins
Core and Builtins<68>.
Tests
Tests<61>.
IDLE
IDLE<47>.
Python 3.5.2 release candidate 1

Security
Security<37>.
Core and Builtins
Core and Builtins<69>.
Library
Library<68>.
IDLE
IDLE<48>.
Documentation
Documentation<60>.
Tests
Tests<62>.
Build
Build<66>.
Windows
Windows<58>.
Tools/Demos
Tools/Demos<35>.
Python 3.5.1 final

Core and Builtins
Core and Builtins<70>.
Windows
Windows<59>.
Python 3.5.1 release candidate 1

Core and Builtins
Core and Builtins<71>.
Library
Library<69>.
IDLE
IDLE<49>.
Documentation
Documentation<61>.
Tests
Tests<63>.
Build
Build<67>.
Windows
Windows<60>.
Tools/Demos
Tools/Demos<36>.
Python 3.5.0 final

Build
Build<68>.
Python 3.5.0 release candidate 4

Library
Library<70>.
Build
Build<69>.
Python 3.5.0 release candidate 3

Core and Builtins
Core and Builtins<72>.
Library
Library<71>.
Python 3.5.0 release candidate 2

Core and Builtins
Core and Builtins<73>.
Library
Library<72>.
Python 3.5.0 release candidate 1

Core and Builtins
Core and Builtins<74>.
Library
Library<73>.
IDLE
IDLE<50>.
Documentation
Documentation<62>.
Tests
Tests<64>.
Python 3.5.0 beta 4

Core and Builtins
Core and Builtins<75>.
Library
Library<74>.
Build
Build<70>.
Python 3.5.0 beta 3

Core and Builtins
Core and Builtins<76>.
Library
Library<75>.
Tests
Tests<65>.
Documentation
Documentation<63>.
Build
Build<71>.
Python 3.5.0 beta 2

Core and Builtins
Core and Builtins<77>.
Library
Library<76>.
Python 3.5.0 beta 1

Core and Builtins
Core and Builtins<78>.
Library
Library<77>.
IDLE
IDLE<51>.
Tests
Tests<66>.
Documentation
Documentation<64>.
Tools/Demos
Tools/Demos<37>.
Python 3.5.0 alpha 4

Core and Builtins
Core and Builtins<79>.
Library
Library<78>.
Build
Build<72>.
Tests
Tests<67>.
Tools/Demos
Tools/Demos<38>.
C API
C API<54>.
Python 3.5.0 alpha 3

Core and Builtins
Core and Builtins<80>.
Library
Library<79>.
Build
Build<73>.
Tests
Tests<68>.
Tools/Demos
Tools/Demos<39>.
Python 3.5.0 alpha 2

Core and Builtins
Core and Builtins<81>.
Library
Library<80>.
Build
Build<74>.
C API
C API<55>.
Windows
Windows<61>.
Python 3.5.0 alpha 1

Core and Builtins
Core and Builtins<82>.
Library
Library<81>.
IDLE
IDLE<52>.
Build
Build<75>.
C API
C API<56>.
Documentation
Documentation<65>.
Tests
Tests<69>.
Tools/Demos
Tools/Demos<40>.
Windows
Windows<62>.
The Python Tutorial

Whetting Your Appetite
Using the Python Interpreter
An Informal Introduction to Python
More Control Flow Tools
Data Structures
Modules
Modules<2>.
Input and Output
Errors and Exceptions
Classes
Brief Tour of the Standard Library
Brief Tour of the Standard Library — Part II
Virtual Environments and Packages
What Now?
Interactive Input Editing and History Substitution
Floating Point Arithmetic; Issues and Limitations
Floating Point Arithmetic Issues and Limitations.
Appendix
Using the Python Interpreter

Invoking the Interpreter
The Interpreter and Its Environment
Invoking the Interpreter

Argument Passing
Interactive Mode
The Interpreter and Its Environment

Source Code Encoding
An Informal Introduction to Python

Using Python as a Calculator
First Steps Towards Programming
Using Python as a Calculator

Numbers
Strings
Lists
More Control Flow Tools

if Statements
for Statements
The range() Function
The range Function.
break and continue Statements, and else Clauses on Loops
break and continue Statements and else Clauses on Loops.
pass Statements
match Statements
Defining Functions
More on Defining Functions
Intermezzo; Coding Style
Intermezzo Coding Style.
More on Defining Functions

Default Argument Values
Keyword Arguments
Special parameters
Arbitrary Argument Lists
Unpacking Argument Lists
Lambda Expressions
Documentation Strings
Function Annotations
Special parameters

Positional-or-Keyword Arguments
Positional-Only Parameters
Keyword-Only Arguments
Function Examples
Recap
Data Structures

More on Lists
The del statement
Tuples and Sequences
Sets
Dictionaries
Looping Techniques
More on Conditions
Comparing Sequences and Other Types
More on Lists

Using Lists as Stacks
Using Lists as Queues
List Comprehensions
List Comprehensions<2>.
Nested List Comprehensions
Modules

More on Modules
Standard Modules
The dir() Function
The dir Function.
Packages
More on Modules

Executing modules as scripts
The Module Search Path
“Compiled” Python files
Packages

Importing * From a Package
Intra-package References
Packages in Multiple Directories
Input and Output

Fancier Output Formatting
Reading and Writing Files
Fancier Output Formatting

Formatted String Literals
The String format() Method
The String format Method.
Manual String Formatting
Old string formatting
Reading and Writing Files

Methods of File Objects
Saving structured data with json
Errors and Exceptions

Syntax Errors
Exceptions
Handling Exceptions
Raising Exceptions
Exception Chaining
User-defined Exceptions
Defining Clean-up Actions
Predefined Clean-up Actions
Raising and Handling Multiple Unrelated Exceptions
Enriching Exceptions with Notes
Classes

A Word About Names and Objects
Python Scopes and Namespaces
A First Look at Classes
Random Remarks
Inheritance
Private Variables
Odds and Ends
Iterators
Generators
Generator Expressions
Python Scopes and Namespaces

Scopes and Namespaces Example
A First Look at Classes

Class Definition Syntax
Class Objects
Instance Objects
Method Objects
Class and Instance Variables
Inheritance

Multiple Inheritance
Brief Tour of the Standard Library

Operating System Interface
File Wildcards
Command Line Arguments
Error Output Redirection and Program Termination
String Pattern Matching
Mathematics
Internet Access
Dates and Times
Data Compression
Performance Measurement
Quality Control
Batteries Included
Brief Tour of the Standard Library — Part II

Output Formatting
Templating
Working with Binary Data Record Layouts
Multi-threading
Multi-threading<2>.
Logging
Weak References
Tools for Working with Lists
Decimal Floating Point Arithmetic
Virtual Environments and Packages

Introduction
Introduction<4>.
Creating Virtual Environments
Managing Packages with pip
Interactive Input Editing and History Substitution

Tab Completion and History Editing
Alternatives to the Interactive Interpreter
Floating Point Arithmetic:  Issues and Limitations

Representation Error
Appendix

Interactive Mode
Interactive Mode<2>.
Interactive Mode

Error Handling
Executable Python Scripts
The Interactive Startup File
The Customization Modules
Python Setup and Usage

Command line and environment
Using Python on Unix platforms
Configure Python
Using Python on Windows
Using Python on a Mac
Editors and IDEs
Command line and environment

Command line
Environment variables
Command line

Interface options
Generic options
Miscellaneous options
Options you shouldn’t use
Environment variables

Debug-mode variables
Using Python on Unix platforms

Getting and installing the latest version of Python
Building Python
Python-related paths and files
Miscellaneous
Custom OpenSSL
Getting and installing the latest version of Python

On Linux
On FreeBSD and OpenBSD
On OpenSolaris
Configure Python

Configure Options
Python Build System
Compiler and linker flags
Configure Options

General Options
WebAssembly Options
Install Options
Performance options
Python Debug Build
Debug options
Linker options
Libraries options
Security Options
macOS Options
Cross Compiling Options
Python Build System

Main files of the build system
Main build steps
Main Makefile targets
C extensions
Compiler and linker flags

Preprocessor flags
Compiler flags
Linker flags
Using Python on Windows

The full installer
The Microsoft Store package
The nuget.org packages
The nuget org packages.
The embeddable package
Alternative bundles
Configuring Python
UTF-8 mode
Python Launcher for Windows
Finding modules
Additional modules
Compiling Python on Windows
Other Platforms
The full installer

Installation steps
Removing the MAX_PATH Limitation
Installing Without UI
Installing Without Downloading
Modifying an install
The Microsoft Store package

Known issues
Known issues

Redirection of local data, registry, and temporary paths
Redirection of local data registry and temporary paths.
The embeddable package

Python Application
Embedding Python
Configuring Python

Excursus; Setting environment variables
Excursus Setting environment variables.
Finding the Python executable
Python Launcher for Windows

Getting started
Shebang Lines
Arguments in shebang lines
Customization
Diagnostics
Dry Run
Install on demand
Return codes
Getting started

From the command-line
Virtual environments
From a script
From file associations
Customization

Customization via INI files
Customizing default Python versions
Additional modules

PyWin32
cx_Freeze
Using Python on a Mac

Getting and Installing MacPython
The IDE
Installing Additional Python Packages
GUI Programming on the Mac
Distributing Python Applications on the Mac
Other Resources
Getting and Installing MacPython

How to run a Python script
Running scripts with a GUI
Configuration
The Python Language Reference

Introduction
Introduction<5>.
Lexical analysis
Data model
Execution model
The import system
Expressions
Simple statements
Compound statements
Top-level components
Full Grammar specification
Introduction

Alternate Implementations
Notation
Lexical analysis

Line structure
Other tokens
Identifiers and keywords
Literals
Operators
Delimiters
Line structure

Logical lines
Physical lines
Comments
Encoding declarations
Explicit line joining
Implicit line joining
Blank lines
Indentation
Whitespace between tokens
Identifiers and keywords

Keywords
Soft Keywords
Reserved classes of identifiers
Literals

String and Bytes literals
String literal concatenation
Formatted string literals
Numeric literals
Integer literals
Floating point literals
Imaginary literals
Data model

Objects, values and types
Objects values and types.
The standard type hierarchy
Special method names
Coroutines
Special method names

Basic customization
Customizing attribute access
Customizing class creation
Customizing instance and subclass checks
Emulating generic types
Emulating callable objects
Emulating container types
Emulating numeric types
With Statement Context Managers
Customizing positional arguments in class pattern matching
Special method lookup
Customizing attribute access

Customizing module attribute access
Implementing Descriptors
Invoking Descriptors
__slots__
__slots__<2>.
__slots__

Notes on using __slots__
Customizing class creation

Metaclasses
Resolving MRO entries
Determining the appropriate metaclass
Preparing the class namespace
Executing the class body
Creating the class object
Uses for metaclasses
Emulating generic types

The purpose of __class_getitem__
__class_getitem__ versus __getitem__
Coroutines

Awaitable Objects
Coroutine Objects
Asynchronous Iterators
Asynchronous Context Managers
Execution model

Structure of a program
Naming and binding
Exceptions
Exceptions<2>.
Naming and binding

Binding of names
Resolution of names
Builtins and restricted execution
Interaction with dynamic features
The import system

importlib
importlib<8>.
Packages
Packages<2>.
Searching
Loading
The Path Based Finder
Replacing the standard import system
Package Relative Imports
Special considerations for __main__
References
Packages

Regular packages
Namespace packages
Searching

The module cache
Finders and loaders
Import hooks
The meta path
Loading

Loaders
Submodules
Module spec
Import-related module attributes
module.__path__
module __path__.
Module reprs
Cached bytecode invalidation
The Path Based Finder

Path entry finders
Path entry finder protocol
Special considerations for __main__

__main__.__spec__
__main__ __spec__.
Expressions

Arithmetic conversions
Atoms
Primaries
Await expression
The power operator
Unary arithmetic and bitwise operations
Binary arithmetic operations
Shifting operations
Binary bitwise operations
Comparisons
Boolean operations
Assignment expressions
Assignment expressions<2>.
Conditional expressions
Lambdas
Expression lists
Evaluation order
Operator precedence
Atoms

Identifiers (Names)
Identifiers Names.
Literals
Literals<2>.
Parenthesized forms
Displays for lists, sets and dictionaries
Displays for lists sets and dictionaries.
List displays
Set displays
Dictionary displays
Generator expressions
Yield expressions
Yield expressions

Generator-iterator methods
Examples
Asynchronous generator functions
Asynchronous generator-iterator methods
Primaries

Attribute references
Subscriptions
Slicings
Calls
Comparisons

Value comparisons
Membership test operations
Identity comparisons
Simple statements

Expression statements
Assignment statements
The assert statement
The pass statement
The del statement
The del statement<2>.
The return statement
The yield statement
The raise statement
The break statement
The continue statement
The import statement
The global statement
The nonlocal statement
Assignment statements

Augmented assignment statements
Annotated assignment statements
The import statement

Future statements
Compound statements

The if statement
The while statement
The for statement
The try statement
The with statement
The match statement
Function definitions
Class definitions
Coroutines
Coroutines<2>.
The try statement

except clause
except* clause
else clause
finally clause
The match statement

Overview
Guards
Irrefutable Case Blocks
Patterns
Patterns

OR Patterns
AS Patterns
Literal Patterns
Capture Patterns
Wildcard Patterns
Value Patterns
Group Patterns
Sequence Patterns
Mapping Patterns
Class Patterns
Coroutines

Coroutine function definition
The async for statement
The async with statement
Top-level components

Complete Python programs
File input
Interactive input
Expression input
The Python Standard Library

Introduction
Introduction<6>.
Built-in Functions
Built-in Constants
Built-in Types
Built-in Exceptions
Text Processing Services
Binary Data Services
Data Types
Numeric and Mathematical Modules
Functional Programming Modules
File and Directory Access
Data Persistence
Data Compression and Archiving
File Formats
Cryptographic Services
Generic Operating System Services
Concurrent Execution
Networking and Interprocess Communication
Internet Data Handling
Structured Markup Processing Tools
Internet Protocols and Support
Multimedia Services
Internationalization
Program Frameworks
Graphical User Interfaces with Tk
Development Tools
Debugging and Profiling
Software Packaging and Distribution
Python Runtime Services
Custom Python Interpreters
Importing Modules
Python Language Services
MS Windows Specific Services
Unix Specific Services
Superseded Modules
Security Considerations
Security Considerations<4>.
Introduction

Notes on availability
Notes on availability

WebAssembly platforms
Built-in Constants

Constants added by the site module
Built-in Types

Truth Value Testing
Boolean Operations — and, or, not
Boolean Operations — and or not.
Comparisons
Comparisons<2>.
Numeric Types — int, float, complex
Numeric Types — int float complex.
Iterator Types
Sequence Types — list, tuple, range
Sequence Types — list tuple range.
Text Sequence Type — str
Binary Sequence Types — bytes, bytearray, memoryview
Binary Sequence Types — bytes bytearray memoryview.
Set Types — set, frozenset
Set Types — set frozenset.
Mapping Types — dict
Context Manager Types
Type Annotation Types — Generic Alias, Union
Type Annotation Types — Generic Alias Union.
Other Built-in Types
Special Attributes
Integer string conversion length limitation
Numeric Types — int, float, complex

Bitwise Operations on Integer Types
Additional Methods on Integer Types
Additional Methods on Float
Hashing of numeric types
Iterator Types

Generator Types
Sequence Types — list, tuple, range

Common Sequence Operations
Immutable Sequence Types
Mutable Sequence Types
Lists
Lists<2>.
Tuples
Ranges
Text Sequence Type — str

String Methods
String Methods<2>.
printf-style String Formatting
Binary Sequence Types — bytes, bytearray, memoryview

Bytes Objects
Bytearray Objects
Bytes and Bytearray Operations
printf-style Bytes Formatting
Memory Views
Mapping Types — dict

Dictionary view objects
Type Annotation Types — Generic Alias, Union

Generic Alias Type
Union Type
Generic Alias Type

Standard Generic Classes
Special Attributes of GenericAlias objects
Other Built-in Types

Modules
Modules<3>.
Classes and Class Instances
Functions
Methods
Code Objects
Type Objects
The Null Object
The Ellipsis Object
The NotImplemented Object
Boolean Values
Internal Objects
Integer string conversion length limitation

Affected APIs
Configuring the limit
Recommended configuration
Built-in Exceptions

Exception context
Inheriting from built-in exceptions
Base classes
Concrete exceptions
Warnings
Exception groups
Exception hierarchy
Concrete exceptions

OS exceptions
Text Processing Services

string — Common string operations
re — Regular expression operations
difflib — Helpers for computing deltas
textwrap — Text wrapping and filling
unicodedata — Unicode Database
stringprep — Internet String Preparation
readline — GNU readline interface
rlcompleter — Completion function for GNU readline
string — Common string operations

String constants
Custom String Formatting
Format String Syntax
Template strings
Helper functions
Format String Syntax

Format Specification Mini-Language
Format examples
re — Regular expression operations

Regular Expression Syntax
Module Contents
Regular Expression Objects
Match Objects
Regular Expression Examples
Module Contents

Flags
Functions
Functions<2>.
Exceptions
Exceptions<3>.
Regular Expression Examples

Checking for a Pair
Simulating scanf()
Simulating scanf.
search() vs. match()
search vs match.
Making a Phonebook
Text Munging
Finding all Adverbs
Finding all Adverbs and their Positions
Raw String Notation
Writing a Tokenizer
difflib — Helpers for computing deltas

SequenceMatcher Objects
SequenceMatcher Examples
Differ Objects
Differ Example
A command-line interface to difflib
readline — GNU readline interface

Init file
Line buffer
History file
History list
Startup hooks
Completion
Example
rlcompleter — Completion function for GNU readline

Completer Objects
Binary Data Services

struct — Interpret bytes as packed binary data
codecs — Codec registry and base classes
struct — Interpret bytes as packed binary data

Functions and Exceptions
Format Strings
Applications
Classes
Classes<2>.
Format Strings

Byte Order, Size, and Alignment
Byte Order Size and Alignment.
Format Characters
Examples
Examples<2>.
Applications

Native Formats
Standard Formats
codecs — Codec registry and base classes

Codec Base Classes
Encodings and Unicode
Standard Encodings
Python Specific Encodings
encodings.idna — Internationalized Domain Names in Applications
encodings idna — Internationalized Domain Names in Applications.
encodings.mbcs — Windows ANSI codepage
encodings mbcs — Windows ANSI codepage.
encodings.utf_8_sig — UTF-8 codec with BOM signature
encodings utf_8_sig — UTF-8 codec with BOM signature.
Codec Base Classes

Error Handlers
Stateless Encoding and Decoding
Incremental Encoding and Decoding
Stream Encoding and Decoding
Incremental Encoding and Decoding

IncrementalEncoder Objects
IncrementalDecoder Objects
Stream Encoding and Decoding

StreamWriter Objects
StreamReader Objects
StreamReaderWriter Objects
StreamRecoder Objects
Python Specific Encodings

Text Encodings
Binary Transforms
Text Transforms
Data Types

datetime — Basic date and time types
zoneinfo — IANA time zone support
calendar — General calendar-related functions
collections — Container datatypes
collections.abc — Abstract Base Classes for Containers
collections abc — Abstract Base Classes for Containers.
heapq — Heap queue algorithm
bisect — Array bisection algorithm
array — Efficient arrays of numeric values
weakref — Weak references
types — Dynamic type creation and names for built-in types
copy — Shallow and deep copy operations
pprint — Data pretty printer
reprlib — Alternate repr() implementation
reprlib — Alternate repr implementation.
enum — Support for enumerations
graphlib — Functionality to operate with graph-like structures
datetime — Basic date and time types

Aware and Naive Objects
Constants
Available Types
timedelta Objects
date Objects
datetime Objects
time Objects
tzinfo Objects
timezone Objects
strftime() and strptime() Behavior
strftime and strptime Behavior.
Available Types

Common Properties
Determining if an Object is Aware or Naive
timedelta Objects

Examples of usage; timedelta
Examples of usage timedelta.
date Objects

Examples of Usage; date
Examples of Usage date.
datetime Objects

Examples of Usage; datetime
Examples of Usage datetime.
time Objects

Examples of Usage; time
Examples of Usage time.
strftime() and strptime() Behavior

strftime() and strptime() Format Codes
strftime and strptime Format Codes.
Technical Detail
zoneinfo — IANA time zone support

Using ZoneInfo
Data sources
The ZoneInfo class
Functions
Functions<3>.
Globals
Exceptions and warnings
Data sources

Configuring the data sources
Configuring the data sources

Compile-time configuration
Environment configuration
Runtime configuration
The ZoneInfo class

String representations
Pickle serialization
collections — Container datatypes

ChainMap objects
Counter objects
deque objects
defaultdict objects
namedtuple() Factory Function for Tuples with Named Fields
namedtuple Factory Function for Tuples with Named Fields.
OrderedDict objects
UserDict objects
UserList objects
UserString objects
ChainMap objects

ChainMap Examples and Recipes
deque objects

deque Recipes
defaultdict objects

defaultdict Examples
OrderedDict objects

OrderedDict Examples and Recipes
collections.abc — Abstract Base Classes for Containers

Collections Abstract Base Classes
Collections Abstract Base Classes – Detailed Descriptions
Examples and Recipes
heapq — Heap queue algorithm

Basic Examples
Priority Queue Implementation Notes
Theory
bisect — Array bisection algorithm

Performance Notes
Searching Sorted Lists
Examples
Examples<3>.
weakref — Weak references

Weak Reference Objects
Example
Example<2>.
Finalizer Objects
Comparing finalizers with __del__() methods
Comparing finalizers with __del__ methods.
types — Dynamic type creation and names for built-in types

Dynamic Type Creation
Standard Interpreter Types
Additional Utility Classes and Functions
Coroutine Utility Functions
pprint — Data pretty printer

PrettyPrinter Objects
Example
Example<3>.
reprlib — Alternate repr() implementation

Repr Objects
Subclassing Repr Objects
enum — Support for enumerations

Module Contents
Module Contents<2>.
Data Types
Data Types<2>.
Utilities and Decorators
Notes
Data Types

Supported __dunder__ names
Supported _sunder_ names
graphlib — Functionality to operate with graph-like structures

Exceptions
Exceptions<4>.
Numeric and Mathematical Modules

numbers — Numeric abstract base classes
math — Mathematical functions
cmath — Mathematical functions for complex numbers
decimal — Decimal fixed point and floating point arithmetic
fractions — Rational numbers
random — Generate pseudo-random numbers
statistics — Mathematical statistics functions
numbers — Numeric abstract base classes

The numeric tower
Notes for type implementors
Notes for type implementors

Adding More Numeric ABCs
Implementing the arithmetic operations
math — Mathematical functions

Number-theoretic and representation functions
Power and logarithmic functions
Trigonometric functions
Angular conversion
Hyperbolic functions
Special functions
Constants
Constants<2>.
cmath — Mathematical functions for complex numbers

Conversions to and from polar coordinates
Power and logarithmic functions
Power and logarithmic functions<2>.
Trigonometric functions
Trigonometric functions<2>.
Hyperbolic functions
Hyperbolic functions<2>.
Classification functions
Constants
Constants<3>.
decimal — Decimal fixed point and floating point arithmetic

Quick-start Tutorial
Decimal objects
Context objects
Constants
Constants<4>.
Rounding modes
Signals
Floating Point Notes
Working with threads
Recipes
Decimal FAQ
Decimal objects

Logical operands
Floating Point Notes

Mitigating round-off error with increased precision
Special values
random — Generate pseudo-random numbers

Bookkeeping functions
Functions for bytes
Functions for integers
Functions for sequences
Real-valued distributions
Alternative Generator
Notes on Reproducibility
Examples
Examples<4>.
Recipes
Recipes<2>.
statistics — Mathematical statistics functions

Averages and measures of central location
Measures of spread
Statistics for relations between two inputs
Function details
Exceptions
Exceptions<5>.
NormalDist objects
NormalDist objects

NormalDist Examples and Recipes
Functional Programming Modules

itertools — Functions creating iterators for efficient looping
functools — Higher-order functions and operations on callable objects
operator — Standard operators as functions
itertools — Functions creating iterators for efficient looping

Itertool functions
Itertools Recipes
functools — Higher-order functions and operations on callable objects

partial Objects
operator — Standard operators as functions

Mapping Operators to Functions
In-place Operators
File and Directory Access

pathlib — Object-oriented filesystem paths
os.path — Common pathname manipulations
os path — Common pathname manipulations.
fileinput — Iterate over lines from multiple input streams
stat — Interpreting stat() results
stat — Interpreting stat results.
filecmp — File and Directory Comparisons
tempfile — Generate temporary files and directories
glob — Unix style pathname pattern expansion
fnmatch — Unix filename pattern matching
linecache — Random access to text lines
shutil — High-level file operations
pathlib — Object-oriented filesystem paths

Basic use
Pure paths
Concrete paths
Correspondence to tools in the os module
Pure paths

General properties
Operators
Operators<2>.
Accessing individual parts
Methods and properties
Concrete paths

Methods
Methods<2>.
filecmp — File and Directory Comparisons

The dircmp class
tempfile — Generate temporary files and directories

Examples
Examples<5>.
Deprecated functions and variables
shutil — High-level file operations

Directory and files operations
Archiving operations
Querying the size of the output terminal
Directory and files operations

Platform-dependent efficient copy operations
copytree example
rmtree example
Archiving operations

Archiving example
Archiving example with base_dir
Data Persistence

pickle — Python object serialization
copyreg — Register pickle support functions
shelve — Python object persistence
marshal — Internal Python object serialization
dbm — Interfaces to Unix “databases”
sqlite3 — DB-API 2.0 interface for SQLite databases
sqlite3 — DB-API 2 0 interface for SQLite databases.
pickle — Python object serialization

Relationship to other Python modules
Data stream format
Module Interface
What can be pickled and unpickled?
Pickling Class Instances
Custom Reduction for Types, Functions, and Other Objects
Custom Reduction for Types Functions and Other Objects.
Out-of-band Buffers
Restricting Globals
Performance
Performance<2>.
Examples
Examples<6>.
Relationship to other Python modules

Comparison with marshal
Comparison with json
Pickling Class Instances

Persistence of External Objects
Dispatch Tables
Handling Stateful Objects
Out-of-band Buffers

Provider API
Consumer API
Example
Example<4>.
copyreg — Register pickle support functions

Example
Example<5>.
shelve — Python object persistence

Restrictions
Example
Example<6>.
dbm — Interfaces to Unix “databases”

dbm.gnu — GNU’s reinterpretation of dbm
dbm gnu — GNU’s reinterpretation of dbm.
dbm.ndbm — Interface based on ndbm
dbm ndbm — Interface based on ndbm.
dbm.dumb — Portable DBM implementation
dbm dumb — Portable DBM implementation.
sqlite3 — DB-API 2.0 interface for SQLite databases

Tutorial
Reference
How-to guides
Explanation
Reference

Module functions
Module constants
Connection objects
Cursor objects
Row objects
Blob objects
PrepareProtocol objects
Exceptions
Exceptions<6>.
SQLite and Python types
Default adapters and converters
How-to guides

How to use placeholders to bind values in SQL queries
How to adapt custom Python types to SQLite values
How to convert SQLite values to custom Python types
Adapter and converter recipes
How to use connection shortcut methods
How to use the connection context manager
How to work with SQLite URIs
How to create and use row factories
How to adapt custom Python types to SQLite values

How to write adaptable objects
How to register adapter callables
Explanation

Transaction control
Data Compression and Archiving

zlib — Compression compatible with gzip
gzip — Support for gzip files
bz2 — Support for bzip2 compression
lzma — Compression using the LZMA algorithm
zipfile — Work with ZIP archives
tarfile — Read and write tar archive files
gzip — Support for gzip files

Examples of usage
Command Line Interface
Command Line Interface

Command line options
bz2 — Support for bzip2 compression

(De)compression of files
De compression of files.
Incremental (de)compression
Incremental de compression.
One-shot (de)compression
One-shot de compression.
Examples of usage
Examples of usage<2>.
lzma — Compression using the LZMA algorithm

Reading and writing compressed files
Compressing and decompressing data in memory
Miscellaneous
Miscellaneous<2>.
Specifying custom filter chains
Examples
Examples<7>.
zipfile — Work with ZIP archives

ZipFile Objects
Path Objects
PyZipFile Objects
ZipInfo Objects
Command-Line Interface
Decompression pitfalls
Command-Line Interface

Command-line options
Decompression pitfalls

From file itself
File System limitations
Resources limitations
Interruption
Default behaviors of extraction
tarfile — Read and write tar archive files

TarFile Objects
TarInfo Objects
Command-Line Interface
Command-Line Interface<2>.
Examples
Examples<8>.
Supported tar formats
Unicode issues
Command-Line Interface

Command-line options
Command-line options<2>.
File Formats

csv — CSV File Reading and Writing
configparser — Configuration file parser
tomllib — Parse TOML files
netrc — netrc file processing
plistlib — Generate and parse Apple .plist files
plistlib — Generate and parse Apple plist files.
csv — CSV File Reading and Writing

Module Contents
Module Contents<3>.
Dialects and Formatting Parameters
Reader Objects
Writer Objects
Examples
Examples<9>.
configparser — Configuration file parser

Quick Start
Supported Datatypes
Fallback Values
Supported INI File Structure
Interpolation of values
Mapping Protocol Access
Customizing Parser Behaviour
Legacy API Examples
ConfigParser Objects
RawConfigParser Objects
Exceptions
Exceptions<7>.
tomllib — Parse TOML files

Examples
Examples<10>.
Conversion Table
netrc — netrc file processing

netrc Objects
plistlib — Generate and parse Apple .plist files

Examples
Examples<11>.
Cryptographic Services

hashlib — Secure hashes and message digests
hmac — Keyed-Hashing for Message Authentication
secrets — Generate secure random numbers for managing secrets
hashlib — Secure hashes and message digests

Hash algorithms
SHAKE variable length digests
File hashing
Key derivation
BLAKE2
BLAKE2

Creating hash objects
Constants
Constants<5>.
Examples
Examples<12>.
Credits
Examples

Simple hashing
Using different digest sizes
Keyed hashing
Randomized hashing
Personalization
Tree mode
secrets — Generate secure random numbers for managing secrets

Random numbers
Generating tokens
Other functions
Recipes and best practices
Generating tokens

How many bytes should tokens use?
Generic Operating System Services

os — Miscellaneous operating system interfaces
io — Core tools for working with streams
time — Time access and conversions
argparse — Parser for command-line options, arguments and sub-commands
argparse — Parser for command-line options arguments and sub-commands.
getopt — C-style parser for command line options
logging — Logging facility for Python
logging.config — Logging configuration
logging config — Logging configuration.
logging.handlers — Logging handlers
logging handlers — Logging handlers.
getpass — Portable password input
curses — Terminal handling for character-cell displays
curses.textpad — Text input widget for curses programs
curses textpad — Text input widget for curses programs.
curses.ascii — Utilities for ASCII characters
curses ascii — Utilities for ASCII characters.
curses.panel — A panel stack extension for curses
curses panel — A panel stack extension for curses.
platform — Access to underlying platform’s identifying data
errno — Standard errno system symbols
ctypes — A foreign function library for Python
os — Miscellaneous operating system interfaces

File Names, Command Line Arguments, and Environment Variables
File Names Command Line Arguments and Environment Variables.
Python UTF-8 Mode
Process Parameters
File Object Creation
File Descriptor Operations
Files and Directories
Process Management
Interface to the scheduler
Miscellaneous System Information
Random numbers
Random numbers<2>.
File Descriptor Operations

Querying the size of a terminal
Inheritance of File Descriptors
Files and Directories

Linux extended attributes
io — Core tools for working with streams

Overview
Overview<2>.
Text Encoding
High-level Module Interface
Class hierarchy
Performance
Performance<3>.
Overview

Text I/O
Binary I/O
Raw I/O
Text Encoding

Opt-in EncodingWarning
Class hierarchy

I/O Base Classes
Raw File I/O
Buffered Streams
Text I/O
Text I/O<2>.
Performance

Binary I/O
Binary I/O<2>.
Text I/O
Text I/O<3>.
Multi-threading
Multi-threading<3>.
Reentrancy
time — Time access and conversions

Functions
Functions<4>.
Clock ID Constants
Timezone Constants
argparse — Parser for command-line options, arguments and sub-commands

Core Functionality
Quick Links for add_argument()
Quick Links for add_argument.
Example
Example<7>.
ArgumentParser objects
The add_argument() method
The add_argument method.
The parse_args() method
The parse_args method.
Other utilities
Upgrading optparse code
Example

Creating a parser
Adding arguments
Parsing arguments
ArgumentParser objects

prog
usage
description
epilog
parents
formatter_class
prefix_chars
fromfile_prefix_chars
argument_default
allow_abbrev
conflict_handler
add_help
exit_on_error
The add_argument() method

name or flags
action
nargs
const
default
type
choices
required
help
metavar
dest
Action classes
The parse_args() method

Option value syntax
Invalid arguments
Arguments containing -
Argument abbreviations (prefix matching)
Argument abbreviations prefix matching.
Beyond sys.argv
Beyond sys argv.
The Namespace object
Other utilities

Sub-commands
FileType objects
Argument groups
Mutual exclusion
Parser defaults
Printing help
Partial parsing
Customizing file parsing
Exiting methods
Intermixed parsing
logging — Logging facility for Python

Logger Objects
Logging Levels
Handler Objects
Formatter Objects
Filter Objects
LogRecord Objects
LogRecord attributes
LoggerAdapter Objects
Thread Safety
Module-Level Functions
Module-Level Attributes
Integration with the warnings module
logging.config — Logging configuration

Configuration functions
Security considerations
Configuration dictionary schema
Configuration file format
Configuration dictionary schema

Dictionary Schema Details
Incremental Configuration
Object connections
User-defined objects
Handler configuration order
Access to external objects
Access to internal objects
Import resolution and custom importers
logging.handlers — Logging handlers

StreamHandler
FileHandler
NullHandler
WatchedFileHandler
BaseRotatingHandler
RotatingFileHandler
TimedRotatingFileHandler
SocketHandler
DatagramHandler
SysLogHandler
NTEventLogHandler
SMTPHandler
MemoryHandler
HTTPHandler
QueueHandler
QueueListener
curses — Terminal handling for character-cell displays

Functions
Functions<5>.
Window Objects
Constants
Constants<6>.
curses.textpad — Text input widget for curses programs

Textbox objects
curses.panel — A panel stack extension for curses

Functions
Functions<6>.
Panel Objects
platform —  Access to underlying platform’s identifying data

Cross Platform
Java Platform
Windows Platform
macOS Platform
Unix Platforms
Linux Platforms
ctypes — A foreign function library for Python

ctypes tutorial
ctypes reference
ctypes tutorial

Loading dynamic link libraries
Accessing functions from loaded dlls
Calling functions
Fundamental data types
Calling functions, continued
Calling functions continued.
Calling varadic functions
Calling functions with your own custom data types
Specifying the required argument types (function prototypes)
Specifying the required argument types function prototypes.
Return types
Passing pointers (or; passing parameters by reference)
Passing pointers or passing parameters by reference.
Structures and unions
Structure/union alignment and byte order
Bit fields in structures and unions
Arrays
Pointers
Type conversions
Incomplete Types
Callback functions
Accessing values exported from dlls
Surprises
Variable-sized data types
ctypes reference

Finding shared libraries
Loading shared libraries
Foreign functions
Function prototypes
Utility functions
Data types
Fundamental data types
Fundamental data types<2>.
Structured data types
Arrays and pointers
Concurrent Execution

threading — Thread-based parallelism
multiprocessing — Process-based parallelism
multiprocessing.shared_memory — Shared memory for direct access across processes
multiprocessing shared_memory — Shared memory for direct access across processes.
The concurrent package
concurrent.futures — Launching parallel tasks
concurrent futures — Launching parallel tasks.
subprocess — Subprocess management
sched — Event scheduler
queue — A synchronized queue class
contextvars — Context Variables
_thread — Low-level threading API
threading — Thread-based parallelism

Thread-Local Data
Thread Objects
Lock Objects
RLock Objects
Condition Objects
Semaphore Objects
Event Objects
Timer Objects
Barrier Objects
Using locks, conditions, and semaphores in the with statement
Using locks conditions and semaphores in the with statement.
Semaphore Objects

Semaphore Example
multiprocessing — Process-based parallelism

Introduction
Introduction<7>.
Reference
Reference<2>.
Programming guidelines
Examples
Examples<13>.
Introduction

The Process class
Contexts and start methods
Exchanging objects between processes
Synchronization between processes
Sharing state between processes
Using a pool of workers
Reference

Process and exceptions
Pipes and Queues
Miscellaneous
Miscellaneous<3>.
Connection Objects
Synchronization primitives
Shared ctypes Objects
Managers
Proxy Objects
Process Pools
Listeners and Clients
Authentication keys
Logging
Logging<2>.
The multiprocessing.dummy module
The multiprocessing dummy module.
Shared ctypes Objects

The multiprocessing.sharedctypes module
The multiprocessing sharedctypes module.
Managers

Customized managers
Using a remote manager
Proxy Objects

Cleanup
Listeners and Clients

Address Formats
Programming guidelines

All start methods
The spawn and forkserver start methods
concurrent.futures — Launching parallel tasks

Executor Objects
ThreadPoolExecutor
ProcessPoolExecutor
Future Objects
Module Functions
Exception classes
ThreadPoolExecutor

ThreadPoolExecutor Example
ProcessPoolExecutor

ProcessPoolExecutor Example
subprocess — Subprocess management

Using the subprocess Module
Security Considerations
Popen Objects
Windows Popen Helpers
Older high-level API
Replacing Older Functions with the subprocess Module
Legacy Shell Invocation Functions
Notes
Notes<2>.
Using the subprocess Module

Frequently Used Arguments
Popen Constructor
Exceptions
Exceptions<8>.
Windows Popen Helpers

Windows Constants
Replacing Older Functions with the subprocess Module

Replacing /bin/sh shell command substitution
Replacing shell pipeline
Replacing os.system()
Replacing os system.
Replacing the os.spawn family
Replacing the os spawn family.
Replacing os.popen(), os.popen2(), os.popen3()
Replacing os popen os popen2 os popen3.
Replacing functions from the popen2 module
Notes

Converting an argument sequence to a string on Windows
Disabling use of vfork() or posix_spawn()
Disabling use of vfork or posix_spawn.
sched — Event scheduler

Scheduler Objects
queue — A synchronized queue class

Queue Objects
SimpleQueue Objects
contextvars — Context Variables

Context Variables
Manual Context Management
asyncio support
Networking and Interprocess Communication

asyncio — Asynchronous I/O
socket — Low-level networking interface
ssl — TLS/SSL wrapper for socket objects
select — Waiting for I/O completion
selectors — High-level I/O multiplexing
signal — Set handlers for asynchronous events
mmap — Memory-mapped file support
asyncio — Asynchronous I/O

Runners
Coroutines and Tasks
Streams
Synchronization Primitives
Subprocesses
Queues
Exceptions
Exceptions<10>.
Event Loop
Futures
Transports and Protocols
Policies
Platform Support
Extending
High-level API Index
Low-level API Index
Developing with asyncio
Runners

Running an asyncio Program
Runner context manager
Handling Keyboard Interruption
Coroutines and Tasks

Coroutines
Coroutines<3>.
Awaitables
Creating Tasks
Task Cancellation
Task Groups
Sleeping
Running Tasks Concurrently
Shielding From Cancellation
Timeouts
Waiting Primitives
Running in Threads
Scheduling From Other Threads
Introspection
Task Object
Streams

StreamReader
StreamWriter
Examples
Examples<14>.
Examples

TCP echo client using streams
TCP echo server using streams
Get HTTP headers
Register an open socket to wait for data using streams
Synchronization Primitives

Lock
Event
Condition
Semaphore
BoundedSemaphore
Barrier
Subprocesses

Creating Subprocesses
Constants
Constants<7>.
Interacting with Subprocesses
Interacting with Subprocesses

Subprocess and Threads
Examples
Examples<15>.
Queues

Queue
Priority Queue
LIFO Queue
Exceptions
Exceptions<9>.
Examples
Examples<16>.
Event Loop

Event Loop Methods
Callback Handles
Server Objects
Event Loop Implementations
Examples
Examples<17>.
Event Loop Methods

Running and stopping the loop
Scheduling callbacks
Scheduling delayed callbacks
Creating Futures and Tasks
Opening network connections
Creating network servers
Transferring files
TLS Upgrade
Watching file descriptors
Working with socket objects directly
DNS
Working with pipes
Unix signals
Executing code in thread or process pools
Error Handling API
Enabling debug mode
Running Subprocesses
Examples

Hello World with call_soon()
Hello World with call_soon.
Display the current date with call_later()
Display the current date with call_later.
Watch a file descriptor for read events
Set signal handlers for SIGINT and SIGTERM
Futures

Future Functions
Future Object
Transports and Protocols

Transports
Protocols
Examples
Examples<18>.
Transports

Transports Hierarchy
Base Transport
Read-only Transports
Write-only Transports
Datagram Transports
Subprocess Transports
Protocols

Base Protocols
Base Protocol
Streaming Protocols
Buffered Streaming Protocols
Datagram Protocols
Subprocess Protocols
Examples

TCP Echo Server
TCP Echo Client
UDP Echo Server
UDP Echo Client
Connecting Existing Sockets
loop.subprocess_exec() and SubprocessProtocol
loop subprocess_exec and SubprocessProtocol.
Policies

Getting and Setting the Policy
Policy Objects
Process Watchers
Custom Policies
Platform Support

All Platforms
Windows
Windows<63>.
macOS
macOS<35>.
Windows

Subprocess Support on Windows
Extending

Writing a Custom Event Loop
Future and Task private constructors
Task lifetime support
High-level API Index

Tasks
Queues
Queues<2>.
Subprocesses
Subprocesses<2>.
Streams
Streams<2>.
Synchronization
Exceptions
Exceptions<11>.
Low-level API Index

Obtaining the Event Loop
Event Loop Methods
Event Loop Methods<2>.
Transports
Transports<2>.
Protocols
Protocols<2>.
Event Loop Policies
Developing with asyncio

Debug Mode
Concurrency and Multithreading
Running Blocking Code
Logging
Logging<3>.
Detect never-awaited coroutines
Detect never-retrieved exceptions
socket — Low-level networking interface

Socket families
Module contents
Socket Objects
Notes on socket timeouts
Example
Example<8>.
Module contents

Exceptions
Exceptions<12>.
Constants
Constants<8>.
Functions
Functions<7>.
Functions

Creating sockets
Other functions
Other functions<2>.
Notes on socket timeouts

Timeouts and the connect method
Timeouts and the accept method
ssl — TLS/SSL wrapper for socket objects

Functions, Constants, and Exceptions
Functions Constants and Exceptions.
SSL Sockets
SSL Contexts
Certificates
Examples
Examples<19>.
Notes on non-blocking sockets
Memory BIO Support
Memory BIO Support<2>.
SSL session
Security considerations
Security considerations<2>.
TLS 1.3
TLS 1 3.
Functions, Constants, and Exceptions

Socket creation
Context creation
Exceptions
Exceptions<13>.
Random generation
Certificate handling
Constants
Constants<9>.
Certificates

Certificate chains
CA certificates
Combined key and certificate
Self-signed certificates
Examples

Testing for SSL support
Client-side operation
Server-side operation
Security considerations

Best defaults
Manual settings
Multi-processing
Manual settings

Verifying certificates
Protocol versions
Cipher selection
select — Waiting for I/O completion

/dev/poll Polling Objects
Edge and Level Trigger Polling (epoll) Objects
Edge and Level Trigger Polling epoll Objects.
Polling Objects
Kqueue Objects
Kevent Objects
selectors — High-level I/O multiplexing

Introduction
Introduction<8>.
Classes
Classes<3>.
Examples
Examples<20>.
signal — Set handlers for asynchronous events

General rules
Module contents
Module contents<2>.
Examples
Examples<21>.
Note on SIGPIPE
Note on Signal Handlers and Exceptions
General rules

Execution of Python signal handlers
Signals and threads
mmap — Memory-mapped file support

MADV_* Constants
MAP_* Constants
Internet Data Handling

email — An email and MIME handling package
json — JSON encoder and decoder
mailbox — Manipulate mailboxes in various formats
mimetypes — Map filenames to MIME types
base64 — Base16, Base32, Base64, Base85 Data Encodings
base64 — Base16 Base32 Base64 Base85 Data Encodings.
binascii — Convert between binary and ASCII
quopri — Encode and decode MIME quoted-printable data
email — An email and MIME handling package

email.message; Representing an email message
email message Representing an email message.
email.parser; Parsing email messages
email parser Parsing email messages.
email.generator; Generating MIME documents
email generator Generating MIME documents.
email.policy; Policy Objects
email policy Policy Objects.
email.errors; Exception and Defect classes
email errors Exception and Defect classes.
email.headerregistry; Custom Header Objects
email headerregistry Custom Header Objects.
email.contentmanager; Managing MIME Content
email contentmanager Managing MIME Content.
email; Examples
email Examples.
email.message.Message; Representing an email message using the compat32 API
email message Message Representing an email message using the compat32 API.
email.mime; Creating email and MIME objects from scratch
email mime Creating email and MIME objects from scratch.
email.header; Internationalized headers
email header Internationalized headers.
email.charset; Representing character sets
email charset Representing character sets.
email.encoders; Encoders
email encoders Encoders.
email.utils; Miscellaneous utilities
email utils Miscellaneous utilities.
email.iterators; Iterators
email iterators Iterators.
email.parser: Parsing email messages

FeedParser API
Parser API
Additional notes
email.contentmanager: Managing MIME Content

Content Manager Instances
json — JSON encoder and decoder

Basic Usage
Encoders and Decoders
Exceptions
Exceptions<14>.
Standard Compliance and Interoperability
Command Line Interface
Command Line Interface<2>.
Standard Compliance and Interoperability

Character Encodings
Infinite and NaN Number Values
Repeated Names Within an Object
Top-level Non-Object, Non-Array Values
Top-level Non-Object Non-Array Values.
Implementation Limitations
Command Line Interface

Command line options
Command line options<2>.
mailbox — Manipulate mailboxes in various formats

Mailbox objects
Message objects
Exceptions
Exceptions<15>.
Examples
Examples<22>.
Mailbox objects

Maildir
mbox
MH
Babyl
MMDF
Message objects

MaildirMessage
mboxMessage
MHMessage
BabylMessage
MMDFMessage
mimetypes — Map filenames to MIME types

MimeTypes Objects
base64 — Base16, Base32, Base64, Base85 Data Encodings

Security Considerations
Security Considerations<2>.
Structured Markup Processing Tools

html — HyperText Markup Language support
html.parser — Simple HTML and XHTML parser
html parser — Simple HTML and XHTML parser.
html.entities — Definitions of HTML general entities
html entities — Definitions of HTML general entities.
XML Processing Modules
xml.etree.ElementTree — The ElementTree XML API
xml etree ElementTree — The ElementTree XML API.
xml.dom — The Document Object Model API
xml dom — The Document Object Model API.
xml.dom.minidom — Minimal DOM implementation
xml dom minidom — Minimal DOM implementation.
xml.dom.pulldom — Support for building partial DOM trees
xml dom pulldom — Support for building partial DOM trees.
xml.sax — Support for SAX2 parsers
xml sax — Support for SAX2 parsers.
xml.sax.handler — Base classes for SAX handlers
xml sax handler — Base classes for SAX handlers.
xml.sax.saxutils — SAX Utilities
xml sax saxutils — SAX Utilities.
xml.sax.xmlreader — Interface for XML parsers
xml sax xmlreader — Interface for XML parsers.
xml.parsers.expat — Fast XML parsing using Expat
xml parsers expat — Fast XML parsing using Expat.
html.parser — Simple HTML and XHTML parser

Example HTML Parser Application
HTMLParser Methods
Examples
Examples<23>.
XML Processing Modules

XML vulnerabilities
The defusedxml Package
xml.etree.ElementTree — The ElementTree XML API

Tutorial
Tutorial<2>.
XPath support
Reference
Reference<3>.
XInclude support
Reference
Reference<4>.
Tutorial

XML tree and elements
Parsing XML
Pull API for non-blocking parsing
Finding interesting elements
Modifying an XML File
Building XML documents
Parsing XML with Namespaces
XPath support

Example
Example<9>.
Supported XPath syntax
Reference

Functions
Functions<8>.
XInclude support

Example
Example<10>.
Reference

Functions
Functions<9>.
Element Objects
ElementTree Objects
QName Objects
TreeBuilder Objects
XMLParser Objects
XMLPullParser Objects
Exceptions
Exceptions<16>.
xml.dom — The Document Object Model API

Module Contents
Module Contents<4>.
Objects in the DOM
Conformance
Objects in the DOM

DOMImplementation Objects
Node Objects
NodeList Objects
DocumentType Objects
Document Objects
Element Objects
Element Objects<2>.
Attr Objects
NamedNodeMap Objects
Comment Objects
Text and CDATASection Objects
ProcessingInstruction Objects
Exceptions
Exceptions<17>.
Conformance

Type Mapping
Accessor Methods
xml.dom.minidom — Minimal DOM implementation

DOM Objects
DOM Example
minidom and the DOM standard
xml.dom.pulldom — Support for building partial DOM trees

DOMEventStream Objects
xml.sax — Support for SAX2 parsers

SAXException Objects
xml.sax.handler — Base classes for SAX handlers

ContentHandler Objects
DTDHandler Objects
EntityResolver Objects
ErrorHandler Objects
LexicalHandler Objects
xml.sax.xmlreader — Interface for XML parsers

XMLReader Objects
IncrementalParser Objects
Locator Objects
InputSource Objects
The Attributes Interface
The AttributesNS Interface
xml.parsers.expat — Fast XML parsing using Expat

XMLParser Objects
XMLParser Objects<2>.
ExpatError Exceptions
Example
Example<11>.
Content Model Descriptions
Expat error constants
Internet Protocols and Support

webbrowser — Convenient web-browser controller
wsgiref — WSGI Utilities and Reference Implementation
urllib — URL handling modules
urllib.request — Extensible library for opening URLs
urllib request — Extensible library for opening URLs.
urllib.response — Response classes used by urllib
urllib response — Response classes used by urllib.
urllib.parse — Parse URLs into components
urllib parse — Parse URLs into components.
urllib.error — Exception classes raised by urllib.request
urllib error — Exception classes raised by urllib request.
urllib.robotparser — Parser for robots.txt
urllib robotparser — Parser for robots txt.
http — HTTP modules
http.client — HTTP protocol client
http client — HTTP protocol client.
ftplib — FTP protocol client
poplib — POP3 protocol client
imaplib — IMAP4 protocol client
smtplib — SMTP protocol client
uuid — UUID objects according to RFC 4122
socketserver — A framework for network servers
http.server — HTTP servers
http server — HTTP servers.
http.cookies — HTTP state management
http cookies — HTTP state management.
http.cookiejar — Cookie handling for HTTP clients
http cookiejar — Cookie handling for HTTP clients.
xmlrpc — XMLRPC server and client modules
xmlrpc.client — XML-RPC client access
xmlrpc client — XML-RPC client access.
xmlrpc.server — Basic XML-RPC servers
xmlrpc server — Basic XML-RPC servers.
ipaddress — IPv4/IPv6 manipulation library
webbrowser — Convenient web-browser controller

Browser Controller Objects
wsgiref — WSGI Utilities and Reference Implementation

wsgiref.util – WSGI environment utilities
wsgiref util – WSGI environment utilities.
wsgiref.headers – WSGI response header tools
wsgiref headers – WSGI response header tools.
wsgiref.simple_server – a simple WSGI HTTP server
wsgiref simple_server – a simple WSGI HTTP server.
wsgiref.validate — WSGI conformance checker
wsgiref validate — WSGI conformance checker.
wsgiref.handlers – server/gateway base classes
wsgiref handlers – server/gateway base classes.
wsgiref.types – WSGI types for static type checking
wsgiref types – WSGI types for static type checking.
Examples
Examples<24>.
urllib.request — Extensible library for opening URLs

Request Objects
OpenerDirector Objects
BaseHandler Objects
HTTPRedirectHandler Objects
HTTPCookieProcessor Objects
ProxyHandler Objects
HTTPPasswordMgr Objects
HTTPPasswordMgrWithPriorAuth Objects
AbstractBasicAuthHandler Objects
HTTPBasicAuthHandler Objects
ProxyBasicAuthHandler Objects
AbstractDigestAuthHandler Objects
HTTPDigestAuthHandler Objects
ProxyDigestAuthHandler Objects
HTTPHandler Objects
HTTPSHandler Objects
FileHandler Objects
DataHandler Objects
FTPHandler Objects
CacheFTPHandler Objects
UnknownHandler Objects
HTTPErrorProcessor Objects
Examples
Examples<25>.
Legacy interface
urllib.request Restrictions
urllib request Restrictions.
urllib.parse — Parse URLs into components

URL Parsing
Parsing ASCII Encoded Bytes
Structured Parse Results
URL Quoting
http — HTTP modules

HTTP status codes
HTTP methods
http.client — HTTP protocol client

HTTPConnection Objects
HTTPResponse Objects
Examples
Examples<26>.
HTTPMessage Objects
ftplib — FTP protocol client

FTP Objects
FTP_TLS Objects
poplib — POP3 protocol client

POP3 Objects
POP3 Example
imaplib — IMAP4 protocol client

IMAP4 Objects
IMAP4 Example
smtplib — SMTP protocol client

SMTP Objects
SMTP Example
uuid — UUID objects according to RFC 4122

Example
Example<12>.
socketserver — A framework for network servers

Server Creation Notes
Server Objects
Server Objects<2>.
Request Handler Objects
Examples
Examples<27>.
Examples

socketserver.TCPServer Example
socketserver TCPServer Example.
socketserver.UDPServer Example
socketserver UDPServer Example.
Asynchronous Mixins
http.server — HTTP servers

Security Considerations
Security Considerations<3>.
http.cookies — HTTP state management

Cookie Objects
Morsel Objects
Example
Example<13>.
http.cookiejar — Cookie handling for HTTP clients

CookieJar and FileCookieJar Objects
FileCookieJar subclasses and co-operation with web browsers
CookiePolicy Objects
DefaultCookiePolicy Objects
Cookie Objects
Cookie Objects<2>.
Examples
Examples<28>.
xmlrpc.client — XML-RPC client access

ServerProxy Objects
DateTime Objects
Binary Objects
Fault Objects
ProtocolError Objects
MultiCall Objects
Convenience Functions
Example of Client Usage
Example of Client and Server Usage
xmlrpc.server — Basic XML-RPC servers

SimpleXMLRPCServer Objects
CGIXMLRPCRequestHandler
Documenting XMLRPC server
DocXMLRPCServer Objects
DocCGIXMLRPCRequestHandler
SimpleXMLRPCServer Objects

SimpleXMLRPCServer Example
ipaddress — IPv4/IPv6 manipulation library

Convenience factory functions
IP Addresses
IP Network definitions
Interface objects
Other Module Level Functions
Custom Exceptions
IP Addresses

Address objects
Conversion to Strings and Integers
Operators
Operators<3>.
Operators

Comparison operators
Arithmetic operators
IP Network definitions

Prefix, net mask and host mask
Prefix net mask and host mask.
Network objects
Operators
Operators<4>.
Operators

Logical operators
Iteration
Networks as containers of addresses
Interface objects

Operators
Operators<5>.
Operators

Logical operators
Logical operators<2>.
Multimedia Services

wave — Read and write WAV files
colorsys — Conversions between color systems
wave — Read and write WAV files

Wave_read Objects
Wave_write Objects
Internationalization

gettext — Multilingual internationalization services
locale — Internationalization services
gettext — Multilingual internationalization services

GNU gettext API
Class-based API
Internationalizing your programs and modules
Acknowledgements
Acknowledgements<9>.
Class-based API

The NullTranslations class
The GNUTranslations class
Solaris message catalog support
The Catalog constructor
Internationalizing your programs and modules

Localizing your module
Localizing your application
Changing languages on the fly
Deferred translations
locale — Internationalization services

Background, details, hints, tips and caveats
Background details hints tips and caveats.
For extension writers and programs that embed Python
Access to message catalogs
Program Frameworks

turtle — Turtle graphics
cmd — Support for line-oriented command interpreters
shlex — Simple lexical analysis
turtle — Turtle graphics

Introduction
Introduction<9>.
Overview of available Turtle and Screen methods
Methods of RawTurtle/Turtle and corresponding functions
Methods of TurtleScreen/Screen and corresponding functions
Public classes
Help and configuration
turtledemo — Demo scripts
Changes since Python 2.6
Changes since Python 2 6.
Changes since Python 3.0
Changes since Python 3 0.
Overview of available Turtle and Screen methods

Turtle methods
Methods of TurtleScreen/Screen
Methods of RawTurtle/Turtle and corresponding functions

Turtle motion
Tell Turtle’s state
Settings for measurement
Pen control
Turtle state
Using events
Special Turtle methods
Compound shapes
Pen control

Drawing state
Color control
Filling
More drawing control
Turtle state

Visibility
Appearance
Methods of TurtleScreen/Screen and corresponding functions

Window control
Animation control
Using screen events
Input methods
Settings and special methods
Methods specific to Screen, not inherited from TurtleScreen
Methods specific to Screen not inherited from TurtleScreen.
Help and configuration

How to use help
Translation of docstrings into different languages
How to configure Screen and Turtles
cmd — Support for line-oriented command interpreters

Cmd Objects
Cmd Example
shlex — Simple lexical analysis

shlex Objects
Parsing Rules
Improved Compatibility with Shells
Graphical User Interfaces with Tk

tkinter — Python interface to Tcl/Tk
tkinter.colorchooser — Color choosing dialog
tkinter colorchooser — Color choosing dialog.
tkinter.font — Tkinter font wrapper
tkinter font — Tkinter font wrapper.
Tkinter Dialogs
tkinter.messagebox — Tkinter message prompts
tkinter messagebox — Tkinter message prompts.
tkinter.scrolledtext — Scrolled Text Widget
tkinter scrolledtext — Scrolled Text Widget.
tkinter.dnd — Drag and drop support
tkinter dnd — Drag and drop support.
tkinter.ttk — Tk themed widgets
tkinter ttk — Tk themed widgets.
tkinter.tix — Extension widgets for Tk
tkinter tix — Extension widgets for Tk.
IDLE
IDLE<53>.
tkinter — Python interface to Tcl/Tk

Architecture
Tkinter Modules
Tkinter Life Preserver
Threading model
Handy Reference
File Handlers
Tkinter Life Preserver

A Hello World Program
Important Tk Concepts
Understanding How Tkinter Wraps Tcl/Tk
How do I…? What option does…?
Navigating the Tcl/Tk Reference Manual
Handy Reference

Setting Options
The Packer
Packer Options
Coupling Widget Variables
The Window Manager
Tk Option Data Types
Bindings and Events
The index Parameter
Images
Tkinter Dialogs

tkinter.simpledialog — Standard Tkinter input dialogs
tkinter simpledialog — Standard Tkinter input dialogs.
tkinter.filedialog — File selection dialogs
tkinter filedialog — File selection dialogs.
tkinter.commondialog — Dialog window templates
tkinter commondialog — Dialog window templates.
tkinter.filedialog — File selection dialogs

Native Load/Save Dialogs
tkinter.ttk — Tk themed widgets

Using Ttk
Ttk Widgets
Widget
Combobox
Spinbox
Notebook
Progressbar
Separator
Sizegrip
Treeview
Ttk Styling
Widget

Standard Options
Scrollable Widget Options
Label Options
Compatibility Options
Widget States
ttk.Widget
ttk Widget.
Combobox

Options
Virtual events
ttk.Combobox
ttk Combobox.
Spinbox

Options
Options<2>.
Virtual events
Virtual events<2>.
ttk.Spinbox
ttk Spinbox.
Notebook

Options
Options<3>.
Tab Options
Tab Identifiers
Virtual Events
ttk.Notebook
ttk Notebook.
Progressbar

Options
Options<4>.
ttk.Progressbar
ttk Progressbar.
Separator

Options
Options<5>.
Sizegrip

Platform-specific notes
Bugs
Treeview

Options
Options<6>.
Item Options
Tag Options
Column Identifiers
Virtual Events
Virtual Events<2>.
ttk.Treeview
ttk Treeview.
Ttk Styling

Layouts
tkinter.tix — Extension widgets for Tk

Using Tix
Tix Widgets
Tix Commands
Tix Widgets

Basic Widgets
File Selectors
Hierarchical ListBox
Tabular ListBox
Manager Widgets
Image Types
Miscellaneous Widgets
Form Geometry Manager
IDLE

Menus
Editing and Navigation
Startup and Code Execution
Help and Preferences
idlelib
Menus

File menu (Shell and Editor)
File menu Shell and Editor.
Edit menu (Shell and Editor)
Edit menu Shell and Editor.
Format menu (Editor window only)
Format menu Editor window only.
Run menu (Editor window only)
Run menu Editor window only.
Shell menu (Shell window only)
Shell menu Shell window only.
Debug menu (Shell window only)
Debug menu Shell window only.
Options menu (Shell and Editor)
Options menu Shell and Editor.
Window menu (Shell and Editor)
Window menu Shell and Editor.
Help menu (Shell and Editor)
Help menu Shell and Editor.
Context menus
Editing and Navigation

Editor windows
Key bindings
Automatic indentation
Search and Replace
Completions
Calltips
Code Context
Shell window
Text colors
Startup and Code Execution

Command line usage
Startup failure
Running user code
User output in Shell
Developing tkinter applications
Running without a subprocess
Help and Preferences

Help sources
Setting preferences
IDLE on macOS
Extensions
Development Tools

typing — Support for type hints
pydoc — Documentation generator and online help system
Python Development Mode
Effects of the Python Development Mode
ResourceWarning Example
Bad file descriptor error example
doctest — Test interactive Python examples
unittest — Unit testing framework
unittest.mock — mock object library
unittest mock — mock object library.
unittest.mock — getting started
unittest mock — getting started.
2to3 — Automated Python 2 to 3 code translation
test — Regression tests package for Python
test.support — Utilities for the Python test suite
test support — Utilities for the Python test suite.
test.support.socket_helper — Utilities for socket tests
test support socket_helper — Utilities for socket tests.
test.support.script_helper — Utilities for the Python execution tests
test support script_helper — Utilities for the Python execution tests.
test.support.bytecode_helper — Support tools for testing correct bytecode generation
test support bytecode_helper — Support tools for testing correct bytecode generation.
test.support.threading_helper — Utilities for threading tests
test support threading_helper — Utilities for threading tests.
test.support.os_helper — Utilities for os tests
test support os_helper — Utilities for os tests.
test.support.import_helper — Utilities for import tests
test support import_helper — Utilities for import tests.
test.support.warnings_helper — Utilities for warnings tests
test support warnings_helper — Utilities for warnings tests.
typing — Support for type hints

Relevant PEPs
Type aliases
NewType
Callable
Generics
User-defined generic types
The Any type
Nominal vs structural subtyping
Module contents
Module contents<3>.
Deprecation Timeline of Major Features
Module contents

Special typing primitives
Generic concrete collections
Abstract Base Classes
Protocols
Protocols<3>.
Functions and decorators
Introspection helpers
Constant
Special typing primitives

Special types
Special forms
Building generic types
Other special directives
Generic concrete collections

Corresponding to built-in types
Corresponding to types in collections
Other concrete types
Abstract Base Classes

Corresponding to collections in collections.abc
Corresponding to collections in collections abc.
Corresponding to other types in collections.abc
Corresponding to other types in collections abc.
Asynchronous programming
Context manager types
doctest — Test interactive Python examples

Simple Usage; Checking Examples in Docstrings
Simple Usage Checking Examples in Docstrings.
Simple Usage; Checking Examples in a Text File
Simple Usage Checking Examples in a Text File.
How It Works
Basic API
Unittest API
Advanced API
Debugging
Soapbox
How It Works

Which Docstrings Are Examined?
How are Docstring Examples Recognized?
What’s the Execution Context?
What About Exceptions?
Option Flags
Directives
Warnings
Warnings<2>.
Advanced API

DocTest Objects
Example Objects
DocTestFinder objects
DocTestParser objects
DocTestRunner objects
OutputChecker objects
unittest — Unit testing framework

Basic example
Command-Line Interface
Command-Line Interface<3>.
Test Discovery
Organizing test code
Re-using old test code
Skipping tests and expected failures
Distinguishing test iterations using subtests
Classes and functions
Class and Module Fixtures
Signal Handling
Command-Line Interface

Command-line options
Command-line options<3>.
Classes and functions

Test cases
Grouping tests
Loading and running tests
Test cases

Deprecated aliases
Loading and running tests

load_tests Protocol
Class and Module Fixtures

setUpClass and tearDownClass
setUpModule and tearDownModule
unittest.mock — mock object library

Quick Guide
The Mock Class
The patchers
MagicMock and magic method support
Helpers
The Mock Class

Calling
Deleting Attributes
Mock names and the name attribute
Attaching Mocks as Attributes
The patchers

patch
patch.object
patch object.
patch.dict
patch dict.
patch.multiple
patch multiple.
patch methods; start and stop
patch methods start and stop.
patch builtins
TEST_PREFIX
Nesting Patch Decorators
Where to patch
Patching Descriptors and Proxy Objects
MagicMock and magic method support

Mocking Magic Methods
Magic Mock
Helpers

sentinel
DEFAULT
call
create_autospec
ANY
FILTER_DIR
mock_open
Autospeccing
Sealing mocks
unittest.mock — getting started

Using Mock
Patch Decorators
Further Examples
Using Mock

Mock Patching Methods
Mock for Method Calls on an Object
Mocking Classes
Naming your mocks
Tracking all Calls
Setting Return Values and Attributes
Raising exceptions with mocks
Side effect functions and iterables
Mocking asynchronous iterators
Mocking asynchronous context manager
Creating a Mock from an Existing Object
Further Examples

Mocking chained calls
Partial mocking
Mocking a Generator Method
Applying the same patch to every test method
Mocking Unbound Methods
Checking multiple calls with mock
Coping with mutable arguments
Nesting Patches
Mocking a dictionary with MagicMock
Mock subclasses and their attributes
Mocking imports with patch.dict
Mocking imports with patch dict.
Tracking order of calls and less verbose call assertions
More complex argument matching
2to3 — Automated Python 2 to 3 code translation

Using 2to3
Fixers
lib2to3 — 2to3’s library
test — Regression tests package for Python

Writing Unit Tests for the test package
Running tests using the command-line interface
Debugging and Profiling

Audit events table
bdb — Debugger framework
faulthandler — Dump the Python traceback
pdb — The Python Debugger
The Python Profilers
timeit — Measure execution time of small code snippets
trace — Trace or track Python statement execution
tracemalloc — Trace memory allocations
faulthandler — Dump the Python traceback

Dumping the traceback
Fault handler state
Dumping the tracebacks after a timeout
Dumping the traceback on a user signal
Issue with file descriptors
Example
Example<14>.
pdb — The Python Debugger

Debugger Commands
The Python Profilers

Introduction to the profilers
Instant User’s Manual
profile and cProfile Module Reference
The Stats Class
What Is Deterministic Profiling?
Limitations
Calibration
Using a custom timer
timeit — Measure execution time of small code snippets

Basic Examples
Basic Examples<2>.
Python Interface
Command-Line Interface
Command-Line Interface<4>.
Examples
Examples<29>.
trace — Trace or track Python statement execution

Command-Line Usage
Programmatic Interface
Command-Line Usage

Main options
Modifiers
Filters
tracemalloc — Trace memory allocations

Examples
Examples<30>.
API
Examples

Display the top 10
Compute differences
Get the traceback of a memory block
Pretty top
Pretty top

Record the current and peak size of all traced memory blocks
API

Functions
Functions<10>.
DomainFilter
Filter
Frame
Snapshot
Statistic
StatisticDiff
Trace
Traceback
Software Packaging and Distribution

distutils — Building and installing Python modules
ensurepip — Bootstrapping the pip installer
venv — Creation of virtual environments
zipapp — Manage executable Python zip archives
ensurepip — Bootstrapping the pip installer

Command line interface
Module API
venv — Creation of virtual environments

Creating virtual environments
How venvs work
API
API<2>.
An example of extending EnvBuilder
zipapp — Manage executable Python zip archives

Basic Example
Command-Line Interface
Command-Line Interface<5>.
Python API
Examples
Examples<31>.
Specifying the Interpreter
Creating Standalone Applications with zipapp
The Python Zip Application Archive Format
Creating Standalone Applications with zipapp

Making a Windows executable
Caveats
Python Runtime Services

sys — System-specific parameters and functions
sysconfig — Provide access to Python’s configuration information
builtins — Built-in objects
__main__ — Top-level code environment
warnings — Warning control
dataclasses — Data Classes
contextlib — Utilities for with-statement contexts
abc — Abstract Base Classes
atexit — Exit handlers
traceback — Print or retrieve a stack traceback
__future__ — Future statement definitions
gc — Garbage Collector interface
inspect — Inspect live objects
site — Site-specific configuration hook
sysconfig — Provide access to Python’s configuration information

Configuration variables
Installation paths
Other functions
Other functions<3>.
Using sysconfig as a script
__main__ — Top-level code environment

__name__ == '__main__'
__main__.py in Python Packages
__main__ py in Python Packages.
import __main__
__name__ == ’__main__’

What is the “top-level code environment”?
Idiomatic Usage
Packaging Considerations
__main__.py in Python Packages

Idiomatic Usage
Idiomatic Usage<2>.
warnings — Warning control

Warning Categories
The Warnings Filter
Temporarily Suppressing Warnings
Testing Warnings
Updating Code For New Versions of Dependencies
Available Functions
Available Context Managers
The Warnings Filter

Describing Warning Filters
Default Warning Filter
Overriding the default filter
dataclasses — Data Classes

Module contents
Module contents<4>.
Post-init processing
Class variables
Init-only variables
Frozen instances
Inheritance
Inheritance<2>.
Re-ordering of keyword-only parameters in __init__()
Re-ordering of keyword-only parameters in __init__.
Default factory functions
Mutable default values
Descriptor-typed fields
contextlib — Utilities for with-statement contexts

Utilities
Examples and Recipes
Examples and Recipes<2>.
Single use, reusable and reentrant context managers
Single use reusable and reentrant context managers.
Examples and Recipes

Supporting a variable number of context managers
Catching exceptions from __enter__ methods
Cleaning up in an __enter__ implementation
Replacing any use of try-finally and flag variables
Using a context manager as a function decorator
Single use, reusable and reentrant context managers

Reentrant context managers
Reusable context managers
atexit — Exit handlers

atexit Example
traceback — Print or retrieve a stack traceback

TracebackException Objects
StackSummary Objects
FrameSummary Objects
Traceback Examples
inspect — Inspect live objects

Types and members
Retrieving source code
Introspecting callables with the Signature object
Classes and functions
Classes and functions<2>.
The interpreter stack
Fetching attributes statically
Current State of Generators and Coroutines
Code Objects Bit Flags
Command Line Interface
Command Line Interface<3>.
site — Site-specific configuration hook

Readline configuration
Module contents
Module contents<5>.
Command Line Interface
Command Line Interface<4>.
Custom Python Interpreters

code — Interpreter base classes
codeop — Compile Python code
code — Interpreter base classes

Interactive Interpreter Objects
Interactive Console Objects
Importing Modules

zipimport — Import modules from Zip archives
pkgutil — Package extension utility
modulefinder — Find modules used by a script
runpy — Locating and executing Python modules
importlib — The implementation of import
importlib.resources – Resources
importlib resources – Resources.
Deprecated functions
importlib.resources.abc – Abstract base classes for resources
importlib resources abc – Abstract base classes for resources.
Using importlib.metadata
Using importlib metadata.
The initialization of the sys.path module search path
The initialization of the sys path module search path.
zipimport — Import modules from Zip archives

zipimporter Objects
Examples
Examples<32>.
modulefinder — Find modules used by a script

Example usage of ModuleFinder
importlib — The implementation of import

Introduction
Introduction<10>.
Functions
Functions<11>.
importlib.abc – Abstract base classes related to import
importlib abc – Abstract base classes related to import.
importlib.machinery – Importers and path hooks
importlib machinery – Importers and path hooks.
importlib.util – Utility code for importers
importlib util – Utility code for importers.
Examples
Examples<33>.
Examples

Importing programmatically
Checking if a module can be imported
Importing a source file directly
Implementing lazy imports
Setting up an importer
Approximating importlib.import_module()
Approximating importlib import_module.
Using importlib.metadata

Overview
Overview<3>.
Functional API
Distributions
Distribution Discovery
Extending the search algorithm
Functional API

Entry points
Distribution metadata
Distribution versions
Distribution files
Distribution requirements
Mapping import to distribution packages
The initialization of the sys.path module search path

Virtual environments
Virtual environments<2>.
_pth files
Embedded Python
Python Language Services

ast — Abstract Syntax Trees
symtable — Access to the compiler’s symbol tables
token — Constants used with Python parse trees
keyword — Testing for Python keywords
tokenize — Tokenizer for Python source
tabnanny — Detection of ambiguous indentation
pyclbr — Python module browser support
py_compile — Compile Python source files
compileall — Byte-compile Python libraries
dis — Disassembler for Python bytecode
pickletools — Tools for pickle developers
ast — Abstract Syntax Trees

Abstract Grammar
Node classes
ast Helpers
Compiler Flags
Command-Line Usage
Command-Line Usage<2>.
Node classes

Literals
Literals<3>.
Variables
Expressions
Expressions<2>.
Statements
Control flow
Pattern matching
Function and class definitions
Async and await
Expressions

Subscripting
Comprehensions
Statements

Imports
symtable — Access to the compiler’s symbol tables

Generating Symbol Tables
Examining Symbol Tables
tokenize — Tokenizer for Python source

Tokenizing Input
Command-Line Usage
Command-Line Usage<3>.
Examples
Examples<34>.
pyclbr — Python module browser support

Function Objects
Class Objects
Class Objects<2>.
py_compile — Compile Python source files

Command-Line Interface
Command-Line Interface<6>.
compileall — Byte-compile Python libraries

Command-line use
Public functions
dis — Disassembler for Python bytecode

Bytecode analysis
Analysis functions
Python Bytecode Instructions
Opcode collections
pickletools — Tools for pickle developers

Command line usage
Command line usage<2>.
Programmatic Interface
Programmatic Interface<2>.
Command line usage

Command line options
Command line options<3>.
MS Windows Specific Services

msvcrt — Useful routines from the MS VC++ runtime
winreg — Windows registry access
winsound — Sound-playing interface for Windows
msvcrt — Useful routines from the MS VC++ runtime

File Operations
Console I/O
Other Functions
winreg — Windows registry access

Functions
Functions<12>.
Constants
Constants<10>.
Registry Handle Objects
Constants

HKEY_* Constants
Access Rights
Value Types
Access Rights

64-bit Specific
Unix Specific Services

posix — The most common POSIX system calls
pwd — The password database
grp — The group database
termios — POSIX style tty control
tty — Terminal control functions
pty — Pseudo-terminal utilities
fcntl — The fcntl and ioctl system calls
resource — Resource usage information
syslog — Unix syslog library routines
posix — The most common POSIX system calls

Large File Support
Notable Module Contents
termios — POSIX style tty control

Example
Example<15>.
pty — Pseudo-terminal utilities

Example
Example<16>.
resource — Resource usage information

Resource Limits
Resource Usage
syslog — Unix syslog library routines

Examples
Examples<35>.
Examples

Simple example
Superseded Modules

aifc — Read and write AIFF and AIFC files
asynchat — Asynchronous socket command/response handler
asyncore — Asynchronous socket handler
audioop — Manipulate raw audio data
cgi — Common Gateway Interface support
cgitb — Traceback manager for CGI scripts
chunk — Read IFF chunked data
crypt — Function to check Unix passwords
imghdr — Determine the type of an image
imp — Access the import internals
mailcap — Mailcap file handling
msilib — Read and write Microsoft Installer files
nis — Interface to Sun’s NIS (Yellow Pages)
nis — Interface to Sun’s NIS Yellow Pages.
nntplib — NNTP protocol client
optparse — Parser for command line options
ossaudiodev — Access to OSS-compatible audio devices
pipes — Interface to shell pipelines
smtpd — SMTP Server
sndhdr — Determine type of sound file
spwd — The shadow password database
sunau — Read and write Sun AU files
telnetlib — Telnet client
uu — Encode and decode uuencode files
xdrlib — Encode and decode XDR data
asynchat — Asynchronous socket command/response handler

asynchat Example
asyncore — Asynchronous socket handler

asyncore Example basic HTTP client
asyncore Example basic echo server
cgi — Common Gateway Interface support

Introduction
Introduction<11>.
Using the cgi module
Higher Level Interface
Functions
Functions<13>.
Caring about security
Installing your CGI script on a Unix system
Testing your CGI script
Debugging CGI scripts
Common problems and solutions
crypt — Function to check Unix passwords

Hashing Methods
Module Attributes
Module Functions
Module Functions<2>.
Examples
Examples<36>.
imp — Access the import internals

Examples
Examples<37>.
msilib — Read and write Microsoft Installer files

Database Objects
View Objects
Summary Information Objects
Record Objects
Errors
CAB Objects
Directory Objects
Features
Features<3>.
GUI classes
Precomputed tables
nntplib — NNTP protocol client

NNTP Objects
Utility functions
Utility functions<2>.
NNTP Objects

Attributes
Methods
Methods<3>.
optparse — Parser for command line options

Background
Tutorial
Tutorial<3>.
Reference Guide
Option Callbacks
Extending optparse
Background

Terminology
What are options for?
What are positional arguments for?
Tutorial

Understanding option actions
The store action
Handling boolean (flag) options
Handling boolean flag options.
Other actions
Default values
Generating help
Printing a version string
How optparse handles errors
Putting it all together
Generating help

Grouping Options
Reference Guide

Creating the parser
Populating the parser
Defining options
Option attributes
Standard option actions
Standard option types
Parsing arguments
Parsing arguments<2>.
Querying and manipulating your option parser
Conflicts between options
Cleanup
Cleanup<2>.
Other methods
Option Callbacks

Defining a callback option
How callbacks are called
Raising errors in a callback
Callback example 1; trivial callback
Callback example 1 trivial callback.
Callback example 2; check option order
Callback example 2 check option order.
Callback example 3; check option order (generalized)
Callback example 3 check option order generalized.
Callback example 4; check arbitrary condition
Callback example 4 check arbitrary condition.
Callback example 5; fixed arguments
Callback example 5 fixed arguments.
Callback example 6; variable arguments
Callback example 6 variable arguments.
Extending optparse

Adding new types
Adding new actions
ossaudiodev — Access to OSS-compatible audio devices

Audio Device Objects
Mixer Device Objects
pipes — Interface to shell pipelines

Template Objects
smtpd — SMTP Server

SMTPServer Objects
DebuggingServer Objects
PureProxy Objects
SMTPChannel Objects
sunau — Read and write Sun AU files

AU_read Objects
AU_write Objects
telnetlib — Telnet client

Telnet Objects
Telnet Example
xdrlib — Encode and decode XDR data

Packer Objects
Unpacker Objects
Exceptions
Exceptions<18>.
Extending and Embedding the Python Interpreter

Recommended third party tools
Creating extensions without third party tools
Embedding the CPython runtime in a larger application
Creating extensions without third party tools

Extending Python with C or C++
Defining Extension Types; Tutorial
Defining Extension Types Tutorial.
Defining Extension Types; Assorted Topics
Defining Extension Types Assorted Topics.
Building C and C++ Extensions
Building C and C++ Extensions on Windows
Extending Python with C or C++

A Simple Example
Intermezzo; Errors and Exceptions
Intermezzo Errors and Exceptions.
Back to the Example
The Module’s Method Table and Initialization Function
Compilation and Linkage
Calling Python Functions from C
Extracting Parameters in Extension Functions
Keyword Parameters for Extension Functions
Building Arbitrary Values
Reference Counts
Writing Extensions in C++
Providing a C API for an Extension Module
Reference Counts

Reference Counting in Python
Ownership Rules
Thin Ice
NULL Pointers
Defining Extension Types: Tutorial

The Basics
Adding data and methods to the Basic example
Providing finer control over data attributes
Supporting cyclic garbage collection
Subclassing other types
Defining Extension Types: Assorted Topics

Finalization and De-allocation
Object Presentation
Attribute Management
Object Comparison
Abstract Protocol Support
Weak Reference Support
More Suggestions
Attribute Management

Generic Attribute Management
Type-specific Attribute Management
Building C and C++ Extensions

Building C and C++ Extensions with distutils
Distributing your extension modules
Building C and C++ Extensions on Windows

A Cookbook Approach
Differences Between Unix and Windows
Using DLLs in Practice
Embedding the CPython runtime in a larger application

Embedding Python in Another Application
Embedding Python in Another Application

Very High Level Embedding
Beyond Very High Level Embedding; An overview
Beyond Very High Level Embedding An overview.
Pure Embedding
Extending Embedded Python
Embedding Python in C++
Compiling and Linking under Unix-like systems
Python/C API Reference Manual

Introduction
Introduction<12>.
C API Stability
The Very High Level Layer
Reference Counting
Exception Handling
Utilities
Utilities<2>.
Abstract Objects Layer
Concrete Objects Layer
Initialization, Finalization, and Threads
Initialization Finalization and Threads.
Python Initialization Configuration
Memory Management
Object Implementation Support
API and ABI Versioning
Introduction

Coding standards
Include Files
Useful macros
Objects, Types and Reference Counts
Objects Types and Reference Counts.
Exceptions
Exceptions<19>.
Embedding Python
Embedding Python<2>.
Debugging Builds
Objects, Types and Reference Counts

Reference Counts
Reference Counts<2>.
Types
Reference Counts

Reference Count Details
C API Stability

Stable Application Binary Interface
Platform Considerations
Contents of Limited API
Stable Application Binary Interface

Limited API Scope and Performance
Limited API Caveats
Exception Handling

Printing and clearing
Raising exceptions
Issuing warnings
Querying the error indicator
Signal Handling
Signal Handling<2>.
Exception Classes
Exception Objects
Unicode Exception Objects
Recursion Control
Standard Exceptions
Standard Warning Categories
Utilities

Operating System Utilities
System Functions
Process Control
Importing Modules
Importing Modules<2>.
Data marshalling support
Parsing arguments and building values
String conversion and formatting
Reflection
Codec registry and support functions
Parsing arguments and building values

Parsing arguments
Parsing arguments<3>.
Building values
Parsing arguments

Strings and buffers
Numbers
Numbers<2>.
Other objects
API Functions
Codec registry and support functions

Codec lookup API
Registry API for Unicode encoding error handlers
Abstract Objects Layer

Object Protocol
Call Protocol
Number Protocol
Sequence Protocol
Mapping Protocol
Iterator Protocol
Buffer Protocol
Old Buffer Protocol
Call Protocol

The tp_call Protocol
The Vectorcall Protocol
Object Calling API
Call Support API
The Vectorcall Protocol

Recursion Control
Recursion Control<2>.
Vectorcall Support API
Buffer Protocol

Buffer structure
Buffer request types
Complex arrays
Buffer-related functions
Buffer request types

request-independent fields
readonly, format
readonly format.
shape, strides, suboffsets
shape strides suboffsets.
contiguity requests
compound requests
Complex arrays

NumPy-style; shape and strides
NumPy-style shape and strides.
PIL-style; shape, strides and suboffsets
PIL-style shape strides and suboffsets.
Concrete Objects Layer

Fundamental Objects
Numeric Objects
Sequence Objects
Container Objects
Function Objects
Function Objects<2>.
Other Objects
Fundamental Objects

Type Objects
Type Objects<2>.
The None Object
Type Objects

Creating Heap-Allocated Types
Numeric Objects

Integer Objects
Boolean Objects
Floating Point Objects
Pack functions
Unpack functions
Complex Number Objects
Floating Point Objects

Pack and Unpack functions
Complex Number Objects

Complex Numbers as C Structures
Complex Numbers as Python Objects
Sequence Objects

Bytes Objects
Bytes Objects<2>.
Byte Array Objects
Unicode Objects and Codecs
Tuple Objects
Struct Sequence Objects
List Objects
Byte Array Objects

Type check macros
Direct API functions
Macros
Unicode Objects and Codecs

Unicode Objects
Built-in Codecs
Methods and Slot Functions
Unicode Objects

Unicode Type
Unicode Character Properties
Creating and accessing Unicode strings
Deprecated Py_UNICODE APIs
Locale Encoding
File System Encoding
wchar_t Support
Built-in Codecs

Generic Codecs
UTF-8 Codecs
UTF-32 Codecs
UTF-16 Codecs
UTF-7 Codecs
Unicode-Escape Codecs
Raw-Unicode-Escape Codecs
Latin-1 Codecs
ASCII Codecs
Character Map Codecs
MBCS codecs for Windows
Methods & Slots
Container Objects

Dictionary Objects
Set Objects
Function Objects

Function Objects
Function Objects<3>.
Instance Method Objects
Method Objects
Method Objects<2>.
Cell Objects
Code Objects
Code Objects<2>.
Other Objects

File Objects
Module Objects
Iterator Objects
Descriptor Objects
Slice Objects
Ellipsis Object
MemoryView objects
Weak Reference Objects
Weak Reference Objects<2>.
Capsules
Capsules<2>.
Frame Objects
Generator Objects
Coroutine Objects
Coroutine Objects<2>.
Context Variables Objects
DateTime Objects
DateTime Objects<2>.
Objects for Type Hinting
Module Objects

Initializing C modules
Module lookup
Initializing C modules

Single-phase initialization
Multi-phase initialization
Low-level module creation functions
Support functions
Initialization, Finalization, and Threads

Before Python Initialization
Global configuration variables
Initializing and finalizing the interpreter
Process-wide parameters
Thread State and the Global Interpreter Lock
Sub-interpreter support
Asynchronous Notifications
Profiling and Tracing
Advanced Debugger Support
Thread Local Storage Support
Thread State and the Global Interpreter Lock

Releasing the GIL from extension code
Non-Python created threads
Cautions about fork()
Cautions about fork.
High-level API
Low-level API
Sub-interpreter support

Bugs and caveats
Thread Local Storage Support

Thread Specific Storage (TSS) API
Thread Specific Storage TSS API.
Thread Local Storage (TLS) API
Thread Local Storage TLS API.
Thread Specific Storage (TSS) API

Dynamic Allocation
Methods
Methods<4>.
Python Initialization Configuration

Example
Example<17>.
PyWideStringList
PyStatus
PyPreConfig
Preinitialize Python with PyPreConfig
PyConfig
Initialization with PyConfig
Isolated Configuration
Python Configuration
Python Path Configuration
Py_RunMain()
Py_RunMain.
Py_GetArgcArgv()
Py_GetArgcArgv.
Multi-Phase Initialization Private Provisional API
Memory Management

Overview
Overview<4>.
Allocator Domains
Raw Memory Interface
Memory Interface
Object allocators
Default Memory Allocators
Customize Memory Allocators
Debug hooks on the Python memory allocators
The pymalloc allocator
tracemalloc C API
Examples
Examples<38>.
The pymalloc allocator

Customize pymalloc Arena Allocator
Object Implementation Support

Allocating Objects on the Heap
Common Object Structures
Type Objects
Type Objects<3>.
Number Object Structures
Mapping Object Structures
Sequence Object Structures
Buffer Object Structures
Async Object Structures
Slot Type typedefs
Examples
Examples<39>.
Supporting Cyclic Garbage Collection
Common Object Structures

Base object types and macros
Implementing functions and methods
Accessing attributes of extension types
Type Objects

Quick Reference
PyTypeObject Definition
PyObject Slots
PyVarObject Slots
PyTypeObject Slots
Static Types
Heap Types
Quick Reference

“tp slots”
sub-slots
slot typedefs
Supporting Cyclic Garbage Collection

Controlling the Garbage Collector State
Distributing Python Modules

Key terms
Open source licensing and collaboration
Installing the tools
Reading the Python Packaging User Guide
How do I…?
How do I…?

… choose a name for my project?
… create and distribute binary extensions?
Installing Python Modules

Key terms
Key terms<2>.
Basic usage
How do I …?
Common installation issues
How do I …?

… install pip in versions of Python prior to Python 3.4?
… install pip in versions of Python prior to Python 3 4?.
… install packages just for the current user?
… install scientific Python packages?
… work with multiple versions of Python installed in parallel?
Common installation issues

Installing into the system Python on Linux
Pip not installed
Installing binary extensions
Python HOWTOs

Porting Python 2 Code to Python 3
Porting Extension Modules to Python 3
Curses Programming with Python
Descriptor HowTo Guide
Enum HOWTO
Functional Programming HOWTO
Logging HOWTO
Logging Cookbook
Regular Expression HOWTO
Socket Programming HOWTO
Sorting HOW TO
Unicode HOWTO
HOWTO Fetch Internet Resources Using The urllib Package
Argparse Tutorial
An introduction to the ipaddress module
Argument Clinic How-To
Instrumenting CPython with DTrace and SystemTap
Annotations Best Practices
Isolating Extension Modules
Porting Python 2 Code to Python 3

The Short Explanation
Details
Details

Drop support for Python 2.6 and older
Drop support for Python 2 6 and older.
Make sure you specify the proper version support in your setup.py file
Make sure you specify the proper version support in your setup py file.
Have good test coverage
Learn the differences between Python 2 & 3
Update your code
Prevent compatibility regressions
Check which dependencies block your transition
Update your setup.py file to denote Python 3 compatibility
Update your setup py file to denote Python 3 compatibility.
Use continuous integration to stay compatible
Consider using optional static type checking
Update your code

Division
Text versus binary data
Use feature detection instead of version detection
Curses Programming with Python

What is curses?
Starting and ending a curses application
Windows and Pads
Displaying Text
User Input
For More Information
What is curses?

The Python curses module
Displaying Text

Attributes and Color
Descriptor HowTo Guide

Primer
Complete Practical Example
Technical Tutorial
Pure Python Equivalents
Primer

Simple example; A descriptor that returns a constant
Simple example A descriptor that returns a constant.
Dynamic lookups
Managed attributes
Customized names
Closing thoughts
Complete Practical Example

Validator class
Custom validators
Practical application
Technical Tutorial

Abstract
Definition and introduction
Descriptor protocol
Overview of descriptor invocation
Invocation from an instance
Invocation from a class
Invocation from super
Summary of invocation logic
Automatic name notification
ORM example
Pure Python Equivalents

Properties
Functions and methods
Kinds of methods
Static methods
Class methods
Member objects and __slots__
Enum HOWTO

Programmatic access to enumeration members and their attributes
Duplicating enum members and values
Ensuring unique enumeration values
Using automatic values
Iteration
Iteration<2>.
Comparisons
Comparisons<3>.
Allowed members and attributes of enumerations
Restricted Enum subclassing
Pickling
Functional API
Functional API<2>.
Derived Enumerations
When to use __new__() vs. __init__()
When to use __new__ vs __init__.
How are Enums and Flags different?
Enum Cookbook
Subclassing EnumType
Derived Enumerations

IntEnum
StrEnum
IntFlag
Flag
Others
When to use __new__() vs. __init__()

Finer Points
Finer Points

Supported __dunder__ names
Supported __dunder__ names<2>.
Supported _sunder_ names
Supported _sunder_ names<2>.
_Private__names
Enum member type
Creating members that are mixed with other data types
Boolean value of Enum classes and members
Enum classes with methods
Combining members of Flag
Flag and IntFlag minutia
How are Enums and Flags different?

Enum Classes
Flag Classes
Enum Members (aka instances)
Enum Members aka instances.
Flag Members
Enum Cookbook

Omitting values
OrderedEnum
DuplicateFreeEnum
Planet
TimePeriod
Omitting values

Using auto
Using object
Using a descriptive string
Using a custom __new__()
Using a custom __new__.
Functional Programming HOWTO

Introduction
Introduction<13>.
Iterators
Iterators<2>.
Generator expressions and list comprehensions
Generators
Generators<2>.
Built-in functions
The itertools module
The functools module
Small functions and the lambda expression
Revision History and Acknowledgements
References
References<2>.
Introduction

Formal provability
Modularity
Ease of debugging and testing
Composability
Iterators

Data Types That Support Iterators
Generators

Passing values into a generator
The itertools module

Creating new iterators
Calling functions on elements
Selecting elements
Combinatoric functions
Grouping elements
The functools module

The operator module
References

General
Python-specific
Python documentation
Logging HOWTO

Basic Logging Tutorial
Advanced Logging Tutorial
Logging Levels
Logging Levels<2>.
Useful Handlers
Exceptions raised during logging
Using arbitrary objects as messages
Optimization
Basic Logging Tutorial

When to use logging
A simple example
Logging to a file
Logging from multiple modules
Logging variable data
Changing the format of displayed messages
Displaying the date/time in messages
Next Steps
Advanced Logging Tutorial

Logging Flow
Loggers
Handlers
Formatters
Configuring Logging
What happens if no configuration is provided
Configuring Logging for a Library
Logging Levels

Custom Levels
Logging Cookbook

Using logging in multiple modules
Logging from multiple threads
Multiple handlers and formatters
Logging to multiple destinations
Custom handling of levels
Configuration server example
Dealing with handlers that block
Sending and receiving logging events across a network
Adding contextual information to your logging output
Use of contextvars
Imparting contextual information in handlers
Logging to a single file from multiple processes
Using file rotation
Use of alternative formatting styles
Customizing LogRecord
Subclassing QueueHandler - a ZeroMQ example
Subclassing QueueListener - a ZeroMQ example
An example dictionary-based configuration
Using a rotator and namer to customize log rotation processing
A more elaborate multiprocessing example
Inserting a BOM into messages sent to a SysLogHandler
Implementing structured logging
Customizing handlers with dictConfig()
Customizing handlers with dictConfig.
Using particular formatting styles throughout your application
Configuring filters with dictConfig()
Configuring filters with dictConfig.
Customized exception formatting
Speaking logging messages
Buffering logging messages and outputting them conditionally
Sending logging messages to email, with buffering
Sending logging messages to email with buffering.
Formatting times using UTC (GMT) via configuration
Formatting times using UTC GMT via configuration.
Using a context manager for selective logging
A CLI application starter template
A Qt GUI for logging
Logging to syslog with RFC5424 support
How to treat a logger like an output stream
Patterns to avoid
Other resources
Sending and receiving logging events across a network

Running a logging socket listener in production
Adding contextual information to your logging output

Using LoggerAdapters to impart contextual information
Using Filters to impart contextual information
Using LoggerAdapters to impart contextual information

Using objects other than dicts to pass contextual information
Logging to a single file from multiple processes

Using concurrent.futures.ProcessPoolExecutor
Using concurrent futures ProcessPoolExecutor.
Deploying Web applications using Gunicorn and uWSGI
Using particular formatting styles throughout your application

Using LogRecord factories
Using custom message objects
Patterns to avoid

Opening the same log file multiple times
Using loggers as attributes in a class or passing them as parameters
Adding handlers other than NullHandler to a logger in a library
Creating a lot of loggers
Regular Expression HOWTO

Introduction
Introduction<14>.
Simple Patterns
Using Regular Expressions
More Pattern Power
Modifying Strings
Common Problems
Feedback
Simple Patterns

Matching Characters
Repeating Things
Using Regular Expressions

Compiling Regular Expressions
The Backslash Plague
Performing Matches
Module-Level Functions
Module-Level Functions<2>.
Compilation Flags
More Pattern Power

More Metacharacters
Grouping
Non-capturing and Named Groups
Lookahead Assertions
Modifying Strings

Splitting Strings
Search and Replace
Search and Replace<2>.
Common Problems

Use String Methods
match() versus search()
match versus search.
Greedy versus Non-Greedy
Using re.VERBOSE
Using re VERBOSE.
Socket Programming HOWTO

Sockets
Creating a Socket
Using a Socket
Disconnecting
Non-blocking Sockets
Sockets

History
Creating a Socket

IPC
Using a Socket

Binary Data
Disconnecting

When Sockets Die
Sorting HOW TO

Sorting Basics
Key Functions
Operator Module Functions
Ascending and Descending
Sort Stability and Complex Sorts
Decorate-Sort-Undecorate
Comparison Functions
Odds and Ends
Odds and Ends<2>.
Unicode HOWTO

Introduction to Unicode
Python’s Unicode Support
Reading and Writing Unicode Data
Acknowledgements
Acknowledgements<10>.
Introduction to Unicode

Definitions
Encodings
References
References<3>.
Python’s Unicode Support

The String Type
Converting to Bytes
Unicode Literals in Python Source Code
Unicode Properties
Comparing Strings
Unicode Regular Expressions
References
References<4>.
Reading and Writing Unicode Data

Unicode filenames
Tips for Writing Unicode-aware Programs
References
References<5>.
Tips for Writing Unicode-aware Programs

Converting Between File Encodings
Files in an Unknown Encoding
HOWTO Fetch Internet Resources Using The urllib Package

Introduction
Introduction<15>.
Fetching URLs
Handling Exceptions
Handling Exceptions<2>.
info and geturl
Openers and Handlers
Basic Authentication
Proxies
Sockets and Layers
Footnotes
Fetching URLs

Data
Headers
Handling Exceptions

URLError
HTTPError
Wrapping it Up
HTTPError

Error Codes
Wrapping it Up

Number 1
Number 2
Argparse Tutorial

Concepts
The basics
Introducing Positional arguments
Introducing Optional arguments
Combining Positional and Optional arguments
Getting a little more advanced
Conclusion
Introducing Optional arguments

Short options
Getting a little more advanced

Conflicting options
An introduction to the ipaddress module

Creating Address/Network/Interface objects
Inspecting Address/Network/Interface Objects
Networks as lists of Addresses
Comparisons
Comparisons<4>.
Using IP Addresses with other modules
Getting more detail when instance creation fails
Creating Address/Network/Interface objects

A Note on IP Versions
IP Host Addresses
Defining Networks
Host Interfaces
Argument Clinic How-To

The Goals Of Argument Clinic
Basic Concepts And Usage
Converting Your First Function
Advanced Topics
Advanced Topics

Symbolic default values
Renaming the C functions and variables generated by Argument Clinic
Converting functions using PyArg_UnpackTuple
Optional Groups
Using real Argument Clinic converters, instead of “legacy converters”
Using real Argument Clinic converters instead of “legacy converters”.
Py_buffer
Advanced converters
Parameter default values
The NULL default value
Expressions specified as default values
Using a return converter
Cloning existing functions
Calling Python code
Using a “self converter”
Using a “defining class” converter
Writing a custom converter
Writing a custom return converter
METH_O and METH_NOARGS
tp_new and tp_init functions
Changing and redirecting Clinic’s output
The #ifdef trick
Using Argument Clinic in Python files
Instrumenting CPython with DTrace and SystemTap

Enabling the static markers
Static DTrace probes
Static SystemTap markers
Available static markers
SystemTap Tapsets
Examples
Examples<40>.
Annotations Best Practices

Accessing The Annotations Dict Of An Object In Python 3.10 And Newer
Accessing The Annotations Dict Of An Object In Python 3 10 And Newer.
Accessing The Annotations Dict Of An Object In Python 3.9 And Older
Accessing The Annotations Dict Of An Object In Python 3 9 And Older.
Manually Un-Stringizing Stringized Annotations
Best Practices For __annotations__ In Any Python Version
__annotations__ Quirks
Isolating Extension Modules

Who should read this
Background
Background<2>.
Making Modules Safe with Multiple Interpreters
Heap Types
Heap Types<2>.
Open Issues
Background

Enter Per-Module State
Isolated Module Objects
Surprising Edge Cases
Making Modules Safe with Multiple Interpreters

Managing Global State
Managing Per-Module State
Opt-Out; Limiting to One Module Object per Process
Opt-Out Limiting to One Module Object per Process.
Module State Access from Functions
Heap Types

Changing Static Types to Heap Types
Defining Heap Types
Garbage-Collection Protocol
Module State Access from Classes
Module State Access from Regular Methods
Module State Access from Slot Methods, Getters and Setters
Module State Access from Slot Methods Getters and Setters.
Lifetime of the Module State
Open Issues

Per-Class Scope
Lossless Conversion to Heap Types
Python Frequently Asked Questions

General Python FAQ
Programming FAQ
Design and History FAQ
Library and Extension FAQ
Extending/Embedding FAQ
Python on Windows FAQ
Graphic User Interface FAQ
“Why is Python Installed on my Computer?” FAQ
General Python FAQ

General Information
Python in the real world
General Information

What is Python?
What is the Python Software Foundation?
Are there copyright restrictions on the use of Python?
Why was Python created in the first place?
What is Python good for?
How does the Python version numbering scheme work?
How do I obtain a copy of the Python source?
How do I get documentation on Python?
I’ve never programmed before. Is there a Python tutorial?
I’ve never programmed before Is there a Python tutorial?.
Is there a newsgroup or mailing list devoted to Python?
How do I get a beta test version of Python?
How do I submit bug reports and patches for Python?
Are there any published articles about Python that I can reference?
Are there any books on Python?
Where in the world is www.python.org located?
Where in the world is www python org located?.
Why is it called Python?
Do I have to like “Monty Python’s Flying Circus”?
Python in the real world

How stable is Python?
How many people are using Python?
Have any significant projects been done in Python?
What new developments are expected for Python in the future?
Is it reasonable to propose incompatible changes to Python?
Is Python a good language for beginning programmers?
Programming FAQ

General Questions
Core Language
Numbers and strings
Performance
Performance<4>.
Sequences (Tuples/Lists)
Sequences Tuples/Lists.
Objects
Modules
Modules<4>.
General Questions

Is there a source code level debugger with breakpoints, single-stepping, etc.?
Is there a source code level debugger with breakpoints single-stepping etc ?.
Are there tools to help find bugs or perform static analysis?
How can I create a stand-alone binary from a Python script?
Are there coding standards or a style guide for Python programs?
Core Language

Why am I getting an UnboundLocalError when the variable has a value?
What are the rules for local and global variables in Python?
Why do lambdas defined in a loop with different values all return the same result?
How do I share global variables across modules?
What are the “best practices” for using import in a module?
Why are default values shared between objects?
How can I pass optional or keyword parameters from one function to another?
What is the difference between arguments and parameters?
Why did changing list ‘y’ also change list ‘x’?
How do I write a function with output parameters (call by reference)?
How do I write a function with output parameters call by reference ?.
How do you make a higher order function in Python?
How do I copy an object in Python?
How can I find the methods or attributes of an object?
How can my code discover the name of an object?
What’s up with the comma operator’s precedence?
Is there an equivalent of C’s “?;” ternary operator?
Is there an equivalent of C’s “? ” ternary operator?.
Is it possible to write obfuscated one-liners in Python?
What does the slash(/) in the parameter list of a function mean?
What does the slash / in the parameter list of a function mean?.
Numbers and strings

How do I specify hexadecimal and octal integers?
Why does -22 // 10 return -3?
How do I get int literal attribute instead of SyntaxError?
How do I convert a string to a number?
How do I convert a number to a string?
How do I modify a string in place?
How do I use strings to call functions/methods?
Is there an equivalent to Perl’s chomp() for removing trailing newlines from strings?
Is there an equivalent to Perl’s chomp for removing trailing newlines from strings?.
Is there a scanf() or sscanf() equivalent?
Is there a scanf or sscanf equivalent?.
What does ‘UnicodeDecodeError’ or ‘UnicodeEncodeError’ error mean?
Can I end a raw string with an odd number of backslashes?
Performance

My program is too slow. How do I speed it up?
My program is too slow How do I speed it up?.
What is the most efficient way to concatenate many strings together?
Sequences (Tuples/Lists)

How do I convert between tuples and lists?
What’s a negative index?
How do I iterate over a sequence in reverse order?
How do you remove duplicates from a list?
How do you remove multiple items from a list
How do you make an array in Python?
How do I create a multidimensional list?
How do I apply a method or function to a sequence of objects?
Why does a_tuple[i] += [‘item’] raise an exception when the addition works?
I want to do a complicated sort; can you do a Schwartzian Transform in Python?
I want to do a complicated sort can you do a Schwartzian Transform in Python?.
How can I sort one list by values from another list?
Objects

What is a class?
What is a method?
What is self?
How do I check if an object is an instance of a given class or of a subclass of it?
What is delegation?
How do I call a method defined in a base class from a derived class that extends it?
How can I organize my code to make it easier to change the base class?
How do I create static class data and static class methods?
How can I overload constructors (or methods) in Python?
How can I overload constructors or methods in Python?.
I try to use __spam and I get an error about _SomeClassName__spam.
I try to use __spam and I get an error about _SomeClassName__spam.
My class defines __del__ but it is not called when I delete the object.
My class defines __del__ but it is not called when I delete the object.
How do I get a list of all instances of a given class?
Why does the result of id() appear to be not unique?
Why does the result of id appear to be not unique?.
When can I rely on identity tests with the is operator?
How can a subclass control what data is stored in an immutable instance?
How do I cache method calls?
Modules

How do I create a .pyc file?
How do I create a pyc file?.
How do I find the current module name?
How can I have modules that mutually import each other?
__import__(‘x.y.z’) returns <module ‘x’>; how do I get z?
__import__ ‘x y z’ returns <module ‘x’>; how do I get z?.
When I edit an imported module and reimport it, the changes don’t show up. Why does this happen?
When I edit an imported module and reimport it the changes don’t show up Why does this happen?.
Design and History FAQ

Why does Python use indentation for grouping of statements?
Why am I getting strange results with simple arithmetic operations?
Why are floating-point calculations so inaccurate?
Why are Python strings immutable?
Why must ‘self’ be used explicitly in method definitions and calls?
Why can’t I use an assignment in an expression?
Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?
Why does Python use methods for some functionality e g list index but functions for other e g len list ?.
Why is join() a string method instead of a list or tuple method?
Why is join a string method instead of a list or tuple method?.
How fast are exceptions?
Why isn’t there a switch or case statement in Python?
Can’t you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?
Why can’t lambda expressions contain statements?
Can Python be compiled to machine code, C or some other language?
Can Python be compiled to machine code C or some other language?.
How does Python manage memory?
Why doesn’t CPython use a more traditional garbage collection scheme?
Why isn’t all memory freed when CPython exits?
Why are there separate tuple and list data types?
How are lists implemented in CPython?
How are dictionaries implemented in CPython?
Why must dictionary keys be immutable?
Why doesn’t list.sort() return the sorted list?
Why doesn’t list sort return the sorted list?.
How do you specify and enforce an interface spec in Python?
Why is there no goto?
Why can’t raw strings (r-strings) end with a backslash?
Why can’t raw strings r-strings end with a backslash?.
Why doesn’t Python have a “with” statement for attribute assignments?
Why don’t generators support the with statement?
Why are colons required for the if/while/def/class statements?
Why does Python allow commas at the end of lists and tuples?
Library and Extension FAQ

General Library Questions
Common tasks
Threads
Input and Output
Input and Output<2>.
Network/Internet Programming
Databases
Mathematics and Numerics
General Library Questions

How do I find a module or application to perform task X?
Where is the math.py (socket.py, regex.py, etc.) source file?
Where is the math py socket py regex py etc source file?.
How do I make a Python script executable on Unix?
Is there a curses/termcap package for Python?
Is there an equivalent to C’s onexit() in Python?
Is there an equivalent to C’s onexit in Python?.
Why don’t my signal handlers work?
Common tasks

How do I test a Python program or component?
How do I create documentation from doc strings?
How do I get a single keypress at a time?
Threads

How do I program using threads?
None of my threads seem to run; why?
None of my threads seem to run why?.
How do I parcel out work among a bunch of worker threads?
What kinds of global value mutation are thread-safe?
Can’t we get rid of the Global Interpreter Lock?
Input and Output

How do I delete a file? (And other file questions…)
How do I delete a file? And other file questions….
How do I copy a file?
How do I read (or write) binary data?
How do I read or write binary data?.
I can’t seem to use os.read() on a pipe created with os.popen(); why?
I can’t seem to use os read on a pipe created with os popen ; why?.
How do I access the serial (RS232) port?
How do I access the serial RS232 port?.
Why doesn’t closing sys.stdout (stdin, stderr) really close it?
Why doesn’t closing sys stdout stdin stderr really close it?.
Network/Internet Programming

What WWW tools are there for Python?
How can I mimic CGI form submission (METHOD=POST)?
How can I mimic CGI form submission METHOD=POST ?.
What module should I use to help with generating HTML?
How do I send mail from a Python script?
How do I avoid blocking in the connect() method of a socket?
How do I avoid blocking in the connect method of a socket?.
Databases

Are there any interfaces to database packages in Python?
How do you implement persistent objects in Python?
Mathematics and Numerics

How do I generate random numbers in Python?
Extending/Embedding FAQ

Can I create my own functions in C?
Can I create my own functions in C++?
Writing C is hard; are there any alternatives?
How can I execute arbitrary Python statements from C?
How can I evaluate an arbitrary Python expression from C?
How do I extract C values from a Python object?
How do I use Py_BuildValue() to create a tuple of arbitrary length?
How do I use Py_BuildValue to create a tuple of arbitrary length?.
How do I call an object’s method from C?
How do I catch the output from PyErr_Print() (or anything that prints to stdout/stderr)?
How do I catch the output from PyErr_Print or anything that prints to stdout/stderr ?.
How do I access a module written in Python from C?
How do I interface to C++ objects from Python?
I added a module using the Setup file and the make fails; why?
How do I debug an extension?
I want to compile a Python module on my Linux system, but some files are missing. Why?
I want to compile a Python module on my Linux system but some files are missing Why?.
How do I tell “incomplete input” from “invalid input”?
How do I find undefined g++ symbols __builtin_new or __pure_virtual?
Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)?
Can I create an object class with some methods implemented in C and others in Python e g through inheritance ?.
Python on Windows FAQ

How do I run a Python program under Windows?
How do I make Python scripts executable?
Why does Python sometimes take so long to start?
How do I make an executable from a Python script?
Is a *.pyd file the same as a DLL?
Is a * pyd file the same as a DLL?.
How can I embed Python into a Windows application?
How do I keep editors from inserting tabs into my Python source?
How do I check for a keypress without blocking?
How do I solve the missing api-ms-win-crt-runtime-l1-1-0.dll error?
How do I solve the missing api-ms-win-crt-runtime-l1-1-0 dll error?.
Graphic User Interface FAQ

General GUI Questions
What GUI toolkits exist for Python?
Tkinter questions
Tkinter questions

How do I freeze Tkinter applications?
Can I have Tk events handled while waiting for I/O?
I can’t get key bindings to work in Tkinter; why?
I can’t get key bindings to work in Tkinter why?.
“Why is Python Installed on my Computer?” FAQ

What is Python?
What is Python?<2>.
Why is Python installed on my machine?
Can I delete Python?
About these documents

Contributors to the Python Documentation
Dealing with Bugs

Documentation bugs
Using the Python issue tracker
Getting started contributing to Python yourself
History and License

History of the software
Terms and conditions for accessing or otherwise using Python
Licenses and Acknowledgements for Incorporated Software
Terms and conditions for accessing or otherwise using Python

PSF LICENSE AGREEMENT FOR PYTHON 3.11.2
PSF LICENSE AGREEMENT FOR PYTHON 3 11 2.
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 0.
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
CNRI LICENSE AGREEMENT FOR PYTHON 1 6 1.
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 2.
ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON 3.11.2 DOCUMENTATION
ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON 3 11 2 DOCUMENTATION.
Licenses and Acknowledgements for Incorporated Software

Mersenne Twister
Sockets
Sockets<2>.
Asynchronous socket services
Cookie management
Execution tracing
UUencode and UUdecode functions
XML Remote Procedure Calls
test_epoll
Select kqueue
SipHash24
strtod and dtoa
OpenSSL
expat
libffi
zlib
zlib<3>.
cfuhash
libmpdec
W3C C14N test suite
Audioop
Distributing Python Modules (Legacy version)

An Introduction to Distutils
Writing the Setup Script
Writing the Setup Configuration File
Creating a Source Distribution
Creating Built Distributions
Distutils Examples
Extending Distutils
Command Reference
API Reference
An Introduction to Distutils

Concepts & Terminology
A Simple Example
A Simple Example<2>.
General Python terminology
Distutils-specific terminology
Writing the Setup Script

Listing whole packages
Listing individual modules
Describing extension modules
Relationships between Distributions and Packages
Installing Scripts
Installing Package Data
Installing Additional Files
Additional meta-data
Debugging the setup script
Describing extension modules

Extension names and packages
Extension source files
Preprocessor options
Library options
Other options
Creating a Source Distribution

Specifying the files to distribute
Manifest-related options
Creating Built Distributions

Creating RPM packages
Cross-compiling on Windows
Cross-compiling on Windows

The Postinstallation script
Distutils Examples

Pure Python distribution (by module)
Pure Python distribution by module.
Pure Python distribution (by package)
Pure Python distribution by package.
Single extension module
Checking a package
Reading the metadata
Extending Distutils

Integrating new commands
Adding new distribution types
Command Reference

Installing modules; the install command family
Installing modules the install command family.
Creating a source distribution; the sdist command
Creating a source distribution the sdist command.
Installing modules: the install command family

install_data
install_scripts
API Reference

distutils.core — Core Distutils functionality
distutils core — Core Distutils functionality.
distutils.ccompiler — CCompiler base class
distutils ccompiler — CCompiler base class.
distutils.unixccompiler — Unix C Compiler
distutils unixccompiler — Unix C Compiler.
distutils.msvccompiler — Microsoft Compiler
distutils msvccompiler — Microsoft Compiler.
distutils.bcppcompiler — Borland Compiler
distutils bcppcompiler — Borland Compiler.
distutils.cygwincompiler — Cygwin Compiler
distutils cygwincompiler — Cygwin Compiler.
distutils.archive_util — Archiving utilities
distutils archive_util — Archiving utilities.
distutils.dep_util — Dependency checking
distutils dep_util — Dependency checking.
distutils.dir_util — Directory tree operations
distutils dir_util — Directory tree operations.
distutils.file_util — Single file operations
distutils file_util — Single file operations.
distutils.util — Miscellaneous other utility functions
distutils util — Miscellaneous other utility functions.
distutils.dist — The Distribution class
distutils dist — The Distribution class.
distutils.extension — The Extension class
distutils extension — The Extension class.
distutils.debug — Distutils debug mode
distutils debug — Distutils debug mode.
distutils.errors — Distutils exceptions
distutils errors — Distutils exceptions.
distutils.fancy_getopt — Wrapper around the standard getopt module
distutils fancy_getopt — Wrapper around the standard getopt module.
distutils.filelist — The FileList class
distutils filelist — The FileList class.
distutils.log — Simple PEP 282-style logging
distutils log — Simple PEP 282-style logging.
distutils.spawn — Spawn a sub-process
distutils spawn — Spawn a sub-process.
distutils.sysconfig — System configuration information
distutils sysconfig — System configuration information.
distutils.text_file — The TextFile class
distutils text_file — The TextFile class.
distutils.version — Version number classes
distutils version — Version number classes.
distutils.cmd — Abstract base class for Distutils commands
distutils cmd — Abstract base class for Distutils commands.
Creating a new Distutils command
distutils.command — Individual Distutils commands
distutils command — Individual Distutils commands.
distutils.command.bdist — Build a binary installer
distutils command bdist — Build a binary installer.
distutils.command.bdist_packager — Abstract base class for packagers
distutils command bdist_packager — Abstract base class for packagers.
distutils.command.bdist_dumb — Build a “dumb” installer
distutils command bdist_dumb — Build a “dumb” installer.
distutils.command.bdist_rpm — Build a binary distribution as a Redhat RPM and SRPM
distutils command bdist_rpm — Build a binary distribution as a Redhat RPM and SRPM.
distutils.command.sdist — Build a source distribution
distutils command sdist — Build a source distribution.
distutils.command.build — Build all files of a package
distutils command build — Build all files of a package.
distutils.command.build_clib — Build any C libraries in a package
distutils command build_clib — Build any C libraries in a package.
distutils.command.build_ext — Build any extensions in a package
distutils command build_ext — Build any extensions in a package.
distutils.command.build_py — Build the .py/.pyc files of a package
distutils command build_py — Build the py/ pyc files of a package.
distutils.command.build_scripts — Build the scripts of a package
distutils command build_scripts — Build the scripts of a package.
distutils.command.clean — Clean a package build area
distutils command clean — Clean a package build area.
distutils.command.config — Perform package configuration
distutils command config — Perform package configuration.
distutils.command.install — Install a package
distutils command install — Install a package.
distutils.command.install_data — Install data files from a package
distutils command install_data — Install data files from a package.
distutils.command.install_headers — Install C/C++ header files from a package
distutils command install_headers — Install C/C++ header files from a package.
distutils.command.install_lib — Install library files from a package
distutils command install_lib — Install library files from a package.
distutils.command.install_scripts — Install script files from a package
distutils command install_scripts — Install script files from a package.
distutils.command.register — Register a module with the Python Package Index
distutils command register — Register a module with the Python Package Index.
distutils.command.check — Check the meta-data of a package
distutils command check — Check the meta-data of a package.
Installing Python Modules (Legacy version)

Introduction
Introduction<16>.
Standard Build and Install
Alternate Installation
Custom Installation
Distutils Configuration Files
Building Extensions; Tips and Tricks
Building Extensions Tips and Tricks.
Introduction

Distutils based source distributions
Standard Build and Install

Platform variations
Splitting the job up
How building works
How installation works
Alternate Installation

Alternate installation; the user scheme
Alternate installation the user scheme.
Alternate installation; the home scheme
Alternate installation the home scheme.
Alternate installation; Unix (the prefix scheme)
Alternate installation Unix the prefix scheme.
Alternate installation; Windows (the prefix scheme)
Alternate installation Windows the prefix scheme.
Custom Installation

Modifying Python’s Search Path
Distutils Configuration Files

Location and names of config files
Syntax of config files
Building Extensions: Tips and Tricks

Tweaking compiler/linker flags
Using non-Microsoft compilers on Windows
Using non-Microsoft compilers on Windows

Borland/CodeGear C++
GNU C / Cygwin / MinGW
GNU C / Cygwin / MinGW

Older Versions of Python and MinGW

automatically generated by info2www version 1.2.2.9