Chapter 2. Modern Python
It’s all in a day’s work for Confuse-a-Cat.
Monty Python
Preview
Python evolves to keep up with our changing technical world. This chapter discusses specific Python features that apply to issues in the previous chapter, and a few extras:
-
Tools
-
APIs and services
-
Variables and type hinting
-
Data structures
-
Web frameworks
Tools
Every computing language has the following:
-
The core language and built-in standard packages
-
Ways to add external packages
-
Recommended external packages
-
An environment of development tools
The following sections list the Python tools required or recommended for this book.
These may change over time! Python packaging and development tools are moving targets, and better solutions come along now and then.
Getting Started
You should be able to write and run a Python program like Example 2-1.
Example 2-1. The Python program that goes like this: this.py
def
paid_promotion
():
(
"(that calls this function!)"
)
(
"This is the program"
)
paid_promotion
()
(
"that goes like this."
)
To execute this program from the command line
in a text window or terminal,
I’ll use the convention of a $
prompt
(your system begging you to type something, already).
What you type after the prompt is shown in bold print
.
If you saved Example 2-1 to a file named this.py, you can run it as shown in Example 2-2.
Example 2-2. Test this.py
$ python this.py This is the program (that calls this function!) that goes like this.
Some ...
Get FastAPI now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.