Conventions used
There are a number of text conventions used throughout this book.
Code in text
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Obviously, if everything is okay, we get a Person
instance and have access to the properly parsed fields."
A block of code is set as follows:
from pydantic import BaseModel class Person(BaseModel): first_name: str last_name: str age: int
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
class PostBase(BaseModel): title: str content: str def excerpt(self) -> str: return f"{self.content[:140]}..."
Any command-line input or output is written as follows:
1 validation error for Person birthdate invalid date format (type=value_error.date)
Tips or important notes
Appear like this.