liveBook · Manning

Python

As explained in Python How-To

Python is a high-level programming language with dynamic semantics and extensive support for readable application code.

Need to build a website, analyze data, or train a machine-learning model? Python is a general-purpose, open-source language with readable syntax, a large community, and packages for each of those jobs. Its concise code also makes it useful for building prototypes. section 1.1 section 1.2

Start with core skills—processing text and structured data, controlling program flow, and handling files—before choosing domain-specific tools. Aim for Pythonic code: a solution that works and remains concise, readable, and maintainable. section 1.0 section 1.1

Check membership without searching for an index

Use `in` when the question is whether an item is present: ```python assert ('cool' in 'Python is cool') == True assert (8 in [1, 2, 3, 4, 5]) == False ``` The expression returns `True` or `False`. If you need the item's position instead, use a sequence's `index` method. section 4.3.1

Distinguish dynamic typing from type hints

A variable can refer to values of different types after reassignment: ```python number = 1 print(type(number)) # <class 'int'> number = "one" print(type(number)) # <class 'str'> ``` Python also allows annotations such as `number: int = 3`, but a type hint does not enforce that type or make Python statically typed. section 6.3.1

Table 1.1 Overview of domain-specific Python tools (view table figure)

Domain

Tool

Highlights

Web development

Flask

A micro web framework; good for building lightweight web apps; flexible extensibility for third-party functionalities

Web development

Django

A complete web framework; good for building database-driven web apps; highly scalable as an enterprise solution

FastAPI

A web framework for building application programming interfaces (APIs); data validation and data conversion; automatic generation of API web interfaces

Streamlit

A web framework for easy building of data-related apps; popular among data scientists and ML engineers

Data science

NumPy

Specialized for processing large, multidimensional arrays; high computational efficiency; integral to many other libraries

pandas

A versatile package for processing spreadsheet-like two-dimensional data; comprehensive data manipulations

statsmodels

A popular package for statistics, such as linear regression, correlation, Bayesian modeling, and survival analysis

Matplotlib

An object-oriented paradigm for drawing histograms, scatter plots, pie charts, and other common figures with a variety of customizable settings

Seaborn

An easy-to-use visualization library for drawing attractive graphics; high-level APIs based on Matplotlib

Machine learning

Scikit-learn

A wide range of preprocessing tools for building ML models; implementation of common ML algorithms

TensorFlow

A framework with both high- and low-level APIs; Tensor board visualization tool; good for building complex neural networks

Keras

High-level APIs for building neural networks; easy to use; good for building low-performance models

PyTorch

A framework for building neural networks; more intuitive code styles than TensorFlow; good for building complex neural networks

FastAI

High-level APIs for building neural networks on top of PyTorch; easy to use

Browse the table to match a project area with specific Python tools, including web frameworks and data-science packages. section 1.2

Choose the language for the product, not just for familiarity. Python runs on common desktop platforms and suits many application domains, but mobile apps and hardware-facing software may be better served by other languages. section 1.2 section 1.3

How Python How-To covers it

How deep it goes
Explains practical language choices, membership syntax, dynamic typing, and optional hints while prioritizing core skills over domain-specific tools.
Examples
Demonstrates `in` with strings and lists, and shows an integer variable becoming a string after reassignment.
What it assumes
Begins with beginner-level core skills, then assumes familiarity with `str`, `list`, `tuple`, and `dict` when introducing type hints.
What you can do after
Practice/perform it by writing readable Python solutions and selecting other languages when mobile or low-level requirements warrant them.
How it connects
Connects Python to Pythonic code, readability, maintainability, sequence membership, type hints, and domain-specific frameworks.

Also explained in

Compare how 26 books explain Python →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Python How-To. The section links point to the parts of the book it draws on.