To get the most out of this book
The reader is expected to have some degree of programming experience and be somehow familiarized with the basics of Python's syntax. Also, basic programming knowledge, like structured programming, and knowledge of object-oriented design is assumed.
To test the code, you need to have Python installed, which can be downloaded from https://www.python.org/downloads/. The code runs with Python 3.9+, and the creation of a virtual environment is highly recommended. Alternative, the code can be tested in a Docker image.
Download the example code files
The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Clean-Code-in-Python-Second-Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781800560215_ColorImages.pdf
Conventions used
There are a number of text conventions used throughout this book.
CodeInText
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example; "Then, just running the pylint
command is enough to check it in the code."
A block of code is set as follows:
@dataclass
class Point:
lat: float
long: float
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
setup(
name="apptool",
description="Description of the intention of the package",
long_description=long_description,
)
Any command-line input or output is written as follows:
>>> locate.__annotations__
{'latitude': float, 'longitue': float, 'return': __main__.Point}
Bold: Indicates a new term, an important word, or words that you see on the screen, for example, in menus or dialog boxes, also appear in the text like this. For example: "We would like a design with a better separation of concerns."
Warnings or important notes appear like this.
Tips and tricks appear like this.