更新时间:2021-06-24 14:56:26
coverpage
Title Page
Copyright and Credits
Expert Python Programming Third Edition
Dedication
About Packt
Why subscribe?
Packt.com
Contributors
About the authors
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Section 1: Before You Start
Current Status of Python
Technical requirements
Where are we now and where we are going to?
Why and how Python changes
Being up-to-date with changes by following PEP documents
Python 3 adoption at the time of writing this book
The main differences between Python 3 and Python 2
Why should I care?
The main syntax differences and common pitfalls
Syntax changes
Changes in the standard library
Changes in data types and collections and string literals
The popular tools and techniques used for maintaining cross-version compatibility
Not only CPython
Stackless Python
Jython
IronPython
PyPy
MicroPython
Useful resources
Summary
Modern Python Development Environments
Installing additional Python packages using pip
Isolating the runtime environment
Application-level isolation versus system-level isolation
Python's venv
venv versus virtualenv
System-level environment isolation
Virtual development environments using Vagrant
Virtual environments using Docker
Containerization versus virtualization
Writing your first Dockerfile
Running containers
Setting up complex environments
Useful Docker recipes for Python
Reducing the size of containers
Addressing services inside of a Compose environment
Communicating between multiple Compose environments
Popular productivity tools
Custom Python shells – ipython bpython ptpython and so on
Setting up the PYTHONSTARTUP environment variable
IPython
bpython
ptpython
Incorporating shells in your own scripts and programs
Interactive debuggers
Section 2: Python Craftsmanship
Modern Syntax Elements - Below the Class Level
Python's built-in types
Strings and bytes
Implementation details
String concatenation
Constant folding the peephole optimizer and the AST optimizer
String formatting with f-strings
Containers
Lists and tuples
List comprehensions
Other idioms
Dictionaries
Weaknesses and alternatives
Sets
Supplemental data types and containers
Specialized data containers from the collections module
Symbolic enumeration with the enum module
Advanced syntax
Iterators
Generators and yield statements
Decorators
General syntax and possible implementations
As a function
As a class