更新时间:2021-07-02 21:10:27
coverpage
Title Page
Credits
About the Author
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
Python Primer
Python basic syntax and block structure
Basic building blocks
Functions
Variables
Expressions
Classes
Flow control statements
Indentation
Python's built-in data structures and comprehensions
Dictionaries
List
Tuple
Set
Comprehension
First-class functions and classes
The defaultdict class
Attributes
The standard library
Different types of packages
What's new in modern Python
The changes in the syntactic
Changes in packages
Other changes in Python packages
Summary
Setting Up
Downloading and installing Python
Choosing a suitable version
Installing Python
Using the command line and the interactive shell
Opening a command-line window
Python interactive shell
Installing packages with pip
The pip tool for packages
Managing installed packages
Finding packages in the Python Package Index
Using keywords
Using Package Index
Searching the Package Index with pip
Legalities and licenses of the Python Package Index
Making a Package
Creating an empty package
Turning a regular folder into a package
Importing all package modules
Adding modules to the package
Module loading with namespace packages
The Package structure and interface
Accessing code from other modules
Importing a cyclic dependency
Resolving attribute errors raised due to cyclic dependencies
Adding static data files to the package
Basic Best Practices
PEP 8 and writing readable code
PEP 8 — guidelines for Python code
Code indentation
Formatting recommendations
Naming conventions
Using version control
Initializing Git
Committing the changes in Git
Undoing the changes
Branches
Merging codes
The mergetool command
The pull command
Using venv to create a stable and isolated work area
Creating a virtual environment
Activating a virtual environment
pip in virtual environments
Getting the most out of docstrings
PEP 257 and docutils
Sphinx
Turning docstrings into HTML
Using doctest to test documentation examples
Testing examples using doctest
What it means when a code example fails
Making a Command-Line Utility
Making a package executable via Python -m
Pipeline program