Table of contents
- 3.6.1 Documentation
- Python Module Index
-
What's New in Python
-
What's New In Python 3.6
- Summary -- Release highlights
-
New Features
- PEP 498: Formatted string literals
- PEP 526: Syntax for variable annotations
- PEP 515: Underscores in Numeric Literals
- PEP 525: Asynchronous Generators
- PEP 530: Asynchronous Comprehensions
- PEP 487: Simpler customization of class creation
- PEP 487: Descriptor Protocol Enhancements
- PEP 519: Adding a file system path protocol
- PEP 495: Local Time Disambiguation
- PEP 529: Change Windows filesystem encoding to UTF-8
- PEP 528: Change Windows console encoding to UTF-8
- PEP 520: Preserving Class Attribute Definition Order
- PEP 468: Preserving Keyword Argument Order
- New dict implementation
- PEP 523: Adding a frame evaluation API to CPython
- PYTHONMALLOC environment variable
- DTrace and SystemTap probing support
- Other Language Changes
- New Modules
-
Improved Modules
- array
- ast
- asyncio
- binascii
- cmath
- collections
- concurrent.futures
- contextlib
- datetime
- decimal
- distutils
- encodings
- enum
- faulthandler
- fileinput
- hashlib
- http.client
- idlelib and IDLE
- importlib
- inspect
- json
- logging
- math
- multiprocessing
- os
- pathlib
- pdb
- pickle
- pickletools
- pydoc
- random
- re
- readline
- rlcompleter
- shlex
- site
- sqlite3
- socket
- socketserver
- ssl
- statistics
- struct
- subprocess
- sys
- telnetlib
- time
- timeit
- tkinter
- traceback
- tracemalloc
- typing
- unicodedata
- unittest.mock
- urllib.request
- urllib.robotparser
- venv
- warnings
- winreg
- winsound
- xmlrpc.client
- zipfile
- zlib
- Optimizations
- Build and C API Changes
- Other Improvements
- Deprecated
- Removed
- Porting to Python 3.6
-
What's New In Python 3.5
- Summary -- Release highlights
-
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 475: Retry system calls failing with EINTR
- PEP 479: Change StopIteration handling inside generators
- PEP 485: A function for testing approximate equality
- PEP 486: Make the Python Launcher aware of virtual environments
- PEP 488: Elimination of PYO files
- PEP 489: Multi-phase extension module initialization
- Other Language Changes
- New Modules
-
Improved Modules
- argparse
- asyncio
- bz2
- cgi
- cmath
- code
- collections
- collections.abc
- compileall
- concurrent.futures
- configparser
- contextlib
- csv
- curses
- dbm
- difflib
- distutils
- doctest
- enum
- faulthandler
- functools
- glob
- gzip
- heapq
- http
- http.client
- idlelib and IDLE
- imaplib
- imghdr
- importlib
- inspect
- io
- ipaddress
- json
- linecache
- locale
- logging
- lzma
- math
- multiprocessing
- operator
- os
- pathlib
- pickle
- poplib
- re
- readline
- selectors
- shutil
- signal
- smtpd
- smtplib
- sndhdr
- socket
- ssl
- sqlite3
- subprocess
- sys
- sysconfig
- tarfile
- threading
- time
- timeit
- tkinter
- traceback
- types
- unicodedata
- unittest
- unittest.mock
- urllib
- wsgiref
- xmlrpc
- xml.sax
- zipfile
- Other module-level changes
- Optimizations
- Build and C API Changes
- Deprecated
- Removed
- Porting to Python 3.5
-
What's New In Python 3.4
- Summary -- Release Highlights
- New Features
- New Modules
-
Improved Modules
- abc
- aifc
- argparse
- audioop
- base64
- collections
- colorsys
- contextlib
- dbm
- dis
- doctest
- filecmp
- functools
- gc
- glob
- hashlib
- hmac
- html
- http
- idlelib and IDLE
- importlib
- inspect
- ipaddress
- logging
- marshal
- mmap
- multiprocessing
- operator
- os
- pdb
- pickle
- plistlib
- poplib
- pprint
- pty
- pydoc
- re
- resource
- select
- shelve
- shutil
- smtpd
- smtplib
- socket
- sqlite3
- ssl
- stat
- struct
- subprocess
- sunau
- sys
- tarfile
- textwrap
- threading
- traceback
- types
- urllib
- unittest
- venv
- wave
- weakref
- xml.etree
- zipfile
- CPython Implementation Changes
- Deprecated
- Removed
- Porting to Python 3.4
- Changed in 3.4.3
-
What's New In Python 3.3
- Summary -- Release highlights
- PEP 405: Virtual Environments
- PEP 420: Implicit Namespace Packages
- PEP 3118: New memoryview implementation and buffer protocol documentation
- PEP 393: Flexible String Representation
- PEP 397: Python Launcher for Windows
- PEP 3151: Reworking the OS and IO exception hierarchy
- PEP 380: Syntax for Delegating to a Subgenerator
- PEP 409: Suppressing exception context
- PEP 414: Explicit Unicode literals
- PEP 3155: Qualified name for classes and functions
- PEP 412: Key-Sharing Dictionary
- PEP 362: Function Signature Object
- PEP 421: Adding sys.implementation
- Using importlib as the Implementation of Import
- Other Language Changes
- A Finer-Grained Import Lock
- Builtin functions and types
- New Modules
-
Improved Modules
- abc
- array
- base64
- binascii
- bz2
- codecs
- collections
- contextlib
- crypt
- curses
- datetime
- decimal
- ftplib
- functools
- gc
- hmac
- http
- html
- imaplib
- inspect
- io
- itertools
- logging
- math
- mmap
- multiprocessing
- nntplib
- os
- pdb
- pickle
- pydoc
- re
- sched
- select
- shlex
- shutil
- signal
- smtpd
- smtplib
- socket
- socketserver
- sqlite3
- ssl
- stat
- struct
- subprocess
- sys
- tarfile
- tempfile
- textwrap
- threading
- time
- types
- unittest
- urllib
- webbrowser
- xml.etree.ElementTree
- zlib
- Optimizations
- Build and C API Changes
- Deprecated
- Porting to Python 3.3
-
What's New In Python 3.2
- PEP 384: Defining a Stable ABI
- PEP 389: Argparse Command Line Parsing Module
- PEP 391: Dictionary Based Configuration for Logging
- PEP 3148: The concurrent.futures module
- PEP 3147: PYC Repository Directories
- PEP 3149: ABI Version Tagged .so Files
- PEP 3333: Python Web Server Gateway Interface v1.0.1
- Other Language Changes
-
New, Improved, and Deprecated Modules
- elementtree
- functools
- itertools
- collections
- threading
- datetime and time
- math
- abc
- io
- reprlib
- logging
- csv
- contextlib
- decimal and fractions
- ftp
- popen
- select
- gzip and zipfile
- tarfile
- hashlib
- ast
- os
- shutil
- sqlite3
- html
- socket
- ssl
- nntp
- certificates
- imaplib
- http.client
- unittest
- random
- poplib
- asyncore
- tempfile
- inspect
- pydoc
- dis
- dbm
- ctypes
- site
- sysconfig
- pdb
- configparser
- urllib.parse
- mailbox
- turtledemo
- Multi-threading
- Optimizations
- Unicode
- Codecs
- Documentation
- IDLE
- Code Repository
- Build and C API Changes
- Porting to Python 3.2
- What's New In Python 3.1
- What's New In Python 3.0
-
What's New in Python 2.7
- The Future for Python 2.x
- Changes to the Handling of Deprecation Warnings
- Python 3.1 Features
- PEP 372: Adding an Ordered Dictionary to collections
- PEP 378: Format Specifier for Thousands Separator
- PEP 389: The argparse Module for Parsing Command Lines
- PEP 391: Dictionary-Based Configuration For Logging
- PEP 3106: Dictionary Views
- PEP 3137: The memoryview Object
- Other Language Changes
- New and Improved Modules
- Build and C API Changes
- Other Changes and Fixes
- Porting to Python 2.7
- New Features Added to Python 2.7 Maintenance Releases
- Acknowledgements
-
What's New in Python 2.6
- Python 3.0
- Changes to the Development Process
- PEP 343: The 'with' statement
- PEP 366: Explicit Relative Imports From a Main Module
- PEP 370: Per-user site-packages Directory
- PEP 371: The multiprocessing Package
- PEP 3101: Advanced String Formatting
- PEP 3105: print As a Function
- PEP 3110: Exception-Handling Changes
- PEP 3112: Byte Literals
- PEP 3116: New I/O Library
- PEP 3118: Revised Buffer Protocol
- PEP 3119: Abstract Base Classes
- PEP 3127: Integer Literal Support and Syntax
- PEP 3129: Class Decorators
- PEP 3141: A Type Hierarchy for Numbers
- Other Language Changes
- New and Improved Modules
- Deprecations and Removals
- Build and C API Changes
- Porting to Python 2.6
- Acknowledgements
-
What's New in Python 2.5
- PEP 308: Conditional Expressions
- PEP 309: Partial Function Application
- PEP 314: Metadata for Python Software Packages v1.1
- PEP 328: Absolute and Relative Imports
- PEP 338: Executing Modules as Scripts
- PEP 341: Unified try/except/finally
- PEP 342: New Generator Features
- PEP 343: The 'with' statement
- PEP 352: Exceptions as New-Style Classes
- PEP 353: Using ssize_t as the index type
- PEP 357: The '__index__' method
- Other Language Changes
- New, Improved, and Removed Modules
- Build and C API Changes
- Porting to Python 2.5
- Acknowledgements
-
What's New in Python 2.4
- PEP 218: Built-In Set Objects
- PEP 237: Unifying Long Integers and Integers
- PEP 289: Generator Expressions
- PEP 292: Simpler String Substitutions
- PEP 318: Decorators for Functions and Methods
- PEP 322: Reverse Iteration
- PEP 324: New subprocess Module
- PEP 327: Decimal Data Type
- PEP 328: Multi-line Imports
- PEP 331: Locale-Independent Float/String Conversions
- Other Language Changes
- New, Improved, and Deprecated Modules
- Build and C API Changes
- Porting to Python 2.4
- Acknowledgements
-
What's New in Python 2.3
- PEP 218: A Standard Set Datatype
- PEP 255: Simple Generators
- PEP 263: Source Code Encodings
- PEP 273: Importing Modules from ZIP Archives
- PEP 277: Unicode file name support for Windows NT
- PEP 278: Universal Newline Support
- PEP 279: enumerate()
- PEP 282: The logging Package
- PEP 285: A Boolean Type
- PEP 293: Codec Error Handling Callbacks
- PEP 301: Package Index and Metadata for Distutils
- PEP 302: New Import Hooks
- PEP 305: Comma-separated Files
- PEP 307: Pickle Enhancements
- Extended Slices
- Other Language Changes
- New, Improved, and Deprecated Modules
- Pymalloc: A Specialized Object Allocator
- Build and C API Changes
- Other Changes and Fixes
- Porting to Python 2.3
- Acknowledgements
-
What's New in Python 2.2
- Introduction
- PEPs 252 and 253: Type and Class Changes
- PEP 234: Iterators
- PEP 255: Simple Generators
- PEP 237: Unifying Long Integers and Integers
- PEP 238: Changing the Division Operator
- Unicode Changes
- PEP 227: Nested Scopes
- New and Improved Modules
- Interpreter Changes and Fixes
- Other Changes and Fixes
- Acknowledgements
-
What's New in Python 2.1
- Introduction
- PEP 227: Nested Scopes
- PEP 236: __future__ Directives
- PEP 207: Rich Comparisons
- PEP 230: Warning Framework
- PEP 229: New Build System
- PEP 205: Weak References
- PEP 232: Function Attributes
- PEP 235: Importing Modules on Case-Insensitive Platforms
- PEP 217: Interactive Display Hook
- PEP 208: New Coercion Model
- PEP 241: Metadata in Python Packages
- New and Improved Modules
- Other Changes and Fixes
- Acknowledgements
-
What's New in Python 2.0
- Introduction
- What About Python 1.6?
- New Development Process
- Unicode
- List Comprehensions
- Augmented Assignment
- String Methods
- Garbage Collection of Cycles
- Other Core Changes
- Porting to 2.0
- Extending/Embedding Changes
- Distutils: Making Modules Easy to Install
- XML Modules
- Module changes
- New modules
- IDLE Improvements
- Deleted and Deprecated Modules
- Acknowledgements
-
Changelog
- Python 3.6.1?
- Python 3.6.1 release candidate 1
- Python 3.6.0?
- Python 3.6.0 release candidate 2?
- Python 3.6.0 release candidate 1?
- Python 3.6.0 beta 4?
- Python 3.6.0 beta 3?
- Python 3.6.0 beta 2?
- Python 3.6.0 beta 1?
- Python 3.6.0 alpha 4?
- Python 3.6.0 alpha 3?
- Python 3.6.0 alpha 2?
- Python 3.6.0 alpha 1?
- Python 3.5.3?
- Python 3.5.3 release candidate 1?
- Python 3.5.2?
- Python 3.5.2 release candidate 1?
- Python 3.5.1 final?
- Python 3.5.1 release candidate 1?
- Python 3.5.0 final?
- Python 3.5.0 release candidate 4?
- Python 3.5.0 release candidate 3?
- Python 3.5.0 release candidate 2?
- Python 3.5.0 release candidate 1?
- Python 3.5.0 beta 4?
- Python 3.5.0 beta 3?
- Python 3.5.0 beta 2?
- Python 3.5.0 beta 1?
- Python 3.5.0 alpha 4?
- Python 3.5.0 alpha 3?
- Python 3.5 alpha 2?
- Python 3.5 alpha 1?
-
What's New In Python 3.6
-
The Python Tutorial
- Whetting Your Appetite
- Using the Python Interpreter
- An Informal Introduction to Python
- More Control Flow Tools
- Data Structures
- Modules
- 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
- Appendix
- Python Setup and Usage
-
The Python Language Reference
- Introduction
- Lexical analysis
-
Data model
- Objects, values and types
- The standard type hierarchy
- Special method names
- Coroutines
- Execution model
- The import system
-
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
- Conditional expressions
- Lambdas
- Expression lists
- Evaluation order
- Operator precedence
- Simple statements
- Compound statements
- Top-level components
- Full Grammar specification
-
The Python Standard Library
- Introduction
- Built-in Functions
- Built-in Constants
-
Built-in Types
- Truth Value Testing
- Boolean Operations --- and, or, not
- Comparisons
- Numeric Types --- int, float, complex
- Iterator Types
- Sequence Types --- list, tuple, range
- Text Sequence Type --- str
- Binary Sequence Types --- bytes, bytearray, memoryview
- Set Types --- set, frozenset
- Mapping Types --- dict
- Context Manager Types
- Other Built-in Types
- Special Attributes
- Built-in 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
-
Binary Data Services
- struct --- Interpret bytes as packed binary data
- codecs --- Codec registry and base classes
-
Data Types
- datetime --- Basic date and time types
- calendar --- General calendar-related functions
- collections --- Container datatypes
- 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
-
enum --- Support for enumerations
- Module Contents
- Creating an Enum
- Programmatic access to enumeration members and their attributes
- Duplicating enum members and values
- Ensuring unique enumeration values
- Using automatic values
- Iteration
- Comparisons
- Allowed members and attributes of enumerations
- Restricted subclassing of enumerations
- Pickling
- Functional API
- Derived Enumerations
- Interesting examples
- How are Enums different?
-
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
- Functional Programming Modules
-
File and Directory Access
- pathlib --- Object-oriented filesystem paths
- os.path --- Common pathname manipulations
- fileinput --- Iterate over lines from multiple input streams
- 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
- macpath --- Mac OS 9 path manipulation functions
-
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
- Data Compression and Archiving
- File Formats
- Cryptographic Services
-
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
- getopt --- C-style parser for command line options
- logging --- Logging facility for Python
- logging.config --- Logging configuration
- logging.handlers --- Logging handlers
- getpass --- Portable password input
- curses --- Terminal handling for character-cell displays
- curses.textpad --- Text input widget for curses programs
- curses.ascii --- Utilities for ASCII characters
- 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
-
ctypes tutorial
- Loading dynamic link libraries
- Accessing functions from loaded dlls
- Calling functions
- Fundamental data types
- Calling functions, continued
- Calling functions with your own custom data types
- Specifying the required argument types (function prototypes)
- Return types
- 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
-
ctypes tutorial
-
Concurrent Execution
- threading --- Thread-based parallelism
- multiprocessing --- Process-based parallelism
- The concurrent package
- concurrent.futures --- Launching parallel tasks
- subprocess --- Subprocess management
- sched --- Event scheduler
- queue --- A synchronized queue class
- dummy_threading --- Drop-in replacement for the threading module
- _thread --- Low-level threading API
- _dummy_thread --- Drop-in replacement for the _thread module
-
Interprocess Communication and Networking
- socket --- Low-level networking interface
- ssl --- TLS/SSL wrapper for socket objects
- select --- Waiting for I/O completion
- selectors --- High-level I/O multiplexing
-
asyncio --- Asynchronous I/O, event loop, coroutines and tasks
- Base Event Loop
- Event loops
- Tasks and coroutines
- Transports and protocols (callback based API)
- Streams (coroutine based API)
- Subprocess
- Synchronization primitives
- Queues
- Develop with asyncio
- asyncore --- Asynchronous socket handler
- asynchat --- Asynchronous socket command/response handler
- signal --- Set handlers for asynchronous events
- mmap --- Memory-mapped file support
-
Internet Data Handling
-
email --- An email and MIME handling package
- email.message: Representing an email message
- email.parser: Parsing email messages
- email.generator: Generating MIME documents
- email.policy: Policy Objects
- email.errors: Exception and Defect classes
- email.headerregistry: Custom Header Objects
- email.contentmanager: Managing MIME Content
- email: Examples
- email.message.Message: Representing an email message using the compat32 API
- email.mime: Creating email and MIME objects from scratch
- email.header: Internationalized headers
- email.charset: Representing character sets
- email.encoders: Encoders
- email.utils: Miscellaneous utilities
- email.iterators: Iterators
- json --- JSON encoder and decoder
- mailcap --- Mailcap file handling
- mailbox --- Manipulate mailboxes in various formats
- mimetypes --- Map filenames to MIME types
- base64 --- Base16, Base32, Base64, Base85 Data Encodings
- binhex --- Encode and decode binhex4 files
- binascii --- Convert between binary and ASCII
- quopri --- Encode and decode MIME quoted-printable data
- uu --- Encode and decode uuencode files
-
email --- An email and MIME handling package
-
Structured Markup Processing Tools
- html --- HyperText Markup Language support
- html.parser --- Simple HTML and XHTML parser
- html.entities --- Definitions of HTML general entities
- XML Processing Modules
- xml.etree.ElementTree --- The ElementTree XML API
- xml.dom --- The Document Object Model API
- xml.dom.minidom --- Minimal DOM implementation
- xml.dom.pulldom --- Support for building partial DOM trees
- xml.sax --- Support for SAX2 parsers
- xml.sax.handler --- Base classes for SAX handlers
- xml.sax.saxutils --- SAX Utilities
- xml.sax.xmlreader --- Interface for XML parsers
- xml.parsers.expat --- Fast XML parsing using Expat
-
Internet Protocols and Support
- webbrowser --- Convenient Web-browser controller
- cgi --- Common Gateway Interface support
- cgitb --- Traceback manager for CGI scripts
- wsgiref --- WSGI Utilities and Reference Implementation
- urllib --- URL handling modules
-
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
- Legacy interface
- urllib.request Restrictions
- urllib.response --- Response classes used by urllib
- urllib.parse --- Parse URLs into components
- urllib.error --- Exception classes raised by urllib.request
- urllib.robotparser --- Parser for robots.txt
- http --- HTTP modules
- http.client --- HTTP protocol client
- ftplib --- FTP protocol client
- poplib --- POP3 protocol client
- imaplib --- IMAP4 protocol client
- nntplib --- NNTP protocol client
- smtplib --- SMTP protocol client
- smtpd --- SMTP Server
- telnetlib --- Telnet client
- uuid --- UUID objects according to RFC 4122
- socketserver --- A framework for network servers
- http.server --- HTTP servers
- http.cookies --- HTTP state management
- http.cookiejar --- Cookie handling for HTTP clients
- xmlrpc --- XMLRPC server and client modules
- xmlrpc.client --- XML-RPC client access
- xmlrpc.server --- Basic XML-RPC servers
- ipaddress --- IPv4/IPv6 manipulation library
-
Multimedia Services
- audioop --- Manipulate raw audio data
- aifc --- Read and write AIFF and AIFC files
- sunau --- Read and write Sun AU files
- wave --- Read and write WAV files
- chunk --- Read IFF chunked data
- colorsys --- Conversions between color systems
- imghdr --- Determine the type of an image
- sndhdr --- Determine type of sound file
- ossaudiodev --- Access to OSS-compatible audio devices
- Internationalization
-
Program Frameworks
- turtle --- Turtle graphics
- cmd --- Support for line-oriented command interpreters
- shlex --- Simple lexical analysis
-
Graphical User Interfaces with Tk
- tkinter --- Python interface to Tcl/Tk
- tkinter.ttk --- Tk themed widgets
- tkinter.tix --- Extension widgets for Tk
- tkinter.scrolledtext --- Scrolled Text Widget
- IDLE
- Other Graphical User Interface Packages
-
Development Tools
- typing --- Support for type hints
- pydoc --- Documentation generator and online help system
- doctest --- Test interactive Python examples
- unittest --- Unit testing framework
- unittest.mock --- mock object library
-
unittest.mock --- getting started
- Using Mock
- Patch Decorators
-
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
- Tracking order of calls and less verbose call assertions
- More complex argument matching
- 2to3 - Automated Python 2 to 3 code translation
- test --- Regression tests package for Python
- test.support --- Utilities for the Python test suite
- Debugging and Profiling
- Software Packaging and Distribution
-
Python Runtime Services
- sys --- System-specific parameters and functions
- sysconfig --- Provide access to Python's configuration information
- builtins --- Built-in objects
- __main__ --- Top-level script environment
- warnings --- Warning control
- 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
- fpectl --- Floating point exception control
- Custom Python Interpreters
-
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
-
Python Language Services
- parser --- Access Python parse trees
- ast --- Abstract Syntax Trees
- symtable --- Access to the compiler's symbol tables
- symbol --- Constants used with Python parse trees
- token --- Constants used with Python parse trees
- keyword --- Testing for Python keywords
- tokenize --- Tokenizer for Python source
- tabnanny --- Detection of ambiguous indentation
- pyclbr --- Python class browser support
- py_compile --- Compile Python source files
- compileall --- Byte-compile Python libraries
- dis --- Disassembler for Python bytecode
- pickletools --- Tools for pickle developers
- Miscellaneous Services
- MS Windows Specific Services
-
Unix Specific Services
- posix --- The most common POSIX system calls
- pwd --- The password database
- spwd --- The shadow password database
- grp --- The group database
- crypt --- Function to check Unix passwords
- termios --- POSIX style tty control
- tty --- Terminal control functions
- pty --- Pseudo-terminal utilities
- fcntl --- The fcntl and ioctl system calls
- pipes --- Interface to shell pipelines
- resource --- Resource usage information
- nis --- Interface to Sun's NIS (Yellow Pages)
- syslog --- Unix syslog library routines
-
Superseded Modules
-
optparse --- Parser for command line options
- Background
- Tutorial
- Reference Guide
-
Option Callbacks
- Defining a callback option
- How callbacks are called
- Raising errors in a callback
- Callback example 1: trivial callback
- Callback example 2: check option order
- Callback example 3: check option order (generalized)
- Callback example 4: check arbitrary condition
- Callback example 5: fixed arguments
- Callback example 6: variable arguments
- Extending optparse
- imp --- Access the import internals
-
optparse --- Parser for command line options
- Undocumented Modules
-
Extending and Embedding the Python Interpreter
- Recommended third party tools
-
Creating extensions without third party tools
-
Extending Python with C or C++
- A Simple Example
- 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
- Defining New Types
- Building C and C++ Extensions
- Building C and C++ Extensions on Windows
-
Extending Python with C or C++
- Embedding the CPython runtime in a larger application
-
Python/C API Reference Manual
- Introduction
- Stable Application Binary Interface
- The Very High Level Layer
- Reference Counting
- Exception Handling
- Utilities
- Abstract Objects Layer
-
Concrete Objects Layer
- Fundamental Objects
- Numeric Objects
- Sequence Objects
- Container Objects
- Function Objects
- Other Objects
- Initialization, Finalization, and Threads
- Memory Management
- Object Implementation Support
- API and ABI Versioning
- Distributing Python Modules
- Installing Python Modules
-
Python HOWTOs
-
Porting Python 2 Code to Python 3
- The Short Explanation
-
Details
- Drop support for Python 2.6 and older
- 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
- Use continuous integration to stay compatible
- Consider using optional static type checking
- Porting Extension Modules to Python 3
- Curses Programming with Python
- Descriptor HowTo Guide
- Functional Programming HOWTO
- Logging HOWTO
-
Logging Cookbook
- Using logging in multiple modules
- Logging from multiple threads
- Multiple handlers and formatters
- Logging to multiple destinations
- Configuration server example
- Dealing with handlers that block
- Sending and receiving logging events across a network
- Adding contextual information to your logging output
- 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()
- Using particular formatting styles throughout your application
- Configuring filters with dictConfig()
- Customized exception formatting
- Speaking logging messages
- Buffering logging messages and outputting them conditionally
- Formatting times using UTC (GMT) via configuration
- Using a context manager for selective logging
- 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
- The Goals Of Argument Clinic
- Basic Concepts And Usage
- Converting Your First Function
-
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"
- 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"
- 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
-
Porting Python 2 Code to Python 3
-
Python Frequently Asked Questions
- General Python FAQ
- Programming FAQ
-
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 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?
- 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?
- How are dictionaries implemented?
- Why must dictionary keys be immutable?
- 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 doesn't Python have a "with" statement for attribute assignments?
- 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
-
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 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 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?
- 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)?
-
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?
- 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 emulate os.kill() in Windows?
- How do I extract the downloaded documentation on Windows?
- Graphic User Interface FAQ
- "Why is Python Installed on my Computer?" FAQ
- Glossary
- About these documents
- Dealing with Bugs
- Copyright
- History and License