Beyond the Basic Stuff with Python 2023

About This Book
This book covers more than just deeper-level Python syntax. It also
discusses using the command line and the command line tools that
professional developers use, such as code formatters, linters, and version
control. I explain what makes code readable and how you can write clean
code. I’ve featured a few programming projects, so you can see these
principles applied in actual software. Although this isn’t a computer science
textbook, I also explain Big O algorithm analysis and object-oriented
design.
No single book can transform a person into a professional software
developer, but I’ve written this book to further your knowledge toward that
end. I introduce several topics that you might only otherwise discover,
piecemeal, through hard-earned experience. After completing this book,
your footing will be on a firmer foundation so you’ll be better equipped to
take on new challenges.
Although I recommend you read the chapters in this book in order, feel
free to skip to whichever chapters capture your interest:
Part I: Getting Started
Chapter 1: Dealing with Errors and Asking for Help Shows you
how to effectively ask questions and find answers on your own. It also
teaches you how to read error messages and the etiquette for asking for
help online.
Chapter 2: Environment Setup and the Command Line Explains
how to navigate the command line along with setting up your
development environment and the PATH environment variable.
Part II: Best Practices, Tools, and Techniques
Chapter 3: Code Formatting with Black Describes the PEP 8 style
guide and how to format your code to make it more readable. You’ll
learn how to automate this process using the Black code-formatting
tool.
Chapter 4: Choosing Understandable Names Describes how you
should name your variables and functions to improve code readability.
Chapter 5: Finding Code Smells Lists several potential red flags that
could indicate the existence of bugs in your code.
Chapter 6: Writing Pythonic Code Details several ways to write
idiomatic Python code and what makes for Pythonic code.
Chapter 7: Programming Jargon Explains technical terms used in
the programming field and terms that are commonly confused with each
other.
Chapter 8: Common Python Gotchas Covers common sources of
confusion and bugs in the Python language and how to correct them, as
well as coding strategies to avoid.
Chapter 9: Esoteric Python Oddities Covers several odd quirks of
the Python language, such as string interning and the antigravity Easter
egg, that you might not otherwise notice. You’ll get an advanced
understanding of how Python works by figuring out why some data
types and operators result in such unexpected behavior.
Chapter 10: Writing Effective Functions Details how to structure
your functions for the most utility and readability. You’ll learn about the
Chapter 11: Comments, Docstrings, and Type Hints Covers the
importance of the non-code parts of your program and how they affect
maintainability. It includes how often you should write comments and
docstrings, and how to make them informative. The chapter also
discusses type hints and how to use static analyzers, such as Mypy, to
detect bugs.
Chapter 12: Organizing Your Code Projects with Git Describes
using the Git version control tool to record the history of changes you
make to your source code and recover previous versions of your work
or track down when a bug first appeared. It also touches on how to
structure your code projects’ files using the Cookiecutter tool.
Chapter 13: Measuring Performance and Big O Algorithm Analysis
Explains how to objectively measure your code’s speed using the
timeit and cProfile modules. In addition, it covers Big O algorithm
analysis and how it lets you predict the way your code’s performance
slows down as the amount of data it has to process grows.
Chapter 14: Practice Projects Has you apply the techniques you
learned in this part by writing two command line games: the Tower of
Hanoi, a puzzle game involving moving disks from one tower to the
next, and the classic Four-in-a-Row board game for two players.