Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Python Design Patterns

You're reading from   Mastering Python Design Patterns Craft essential Python patterns by following core design principles

Arrow left icon
Product type Paperback
Published in May 2024
Publisher Packt
ISBN-13 9781837639618
Length 296 pages
Edition 3rd Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Kamon Ayeva Kamon Ayeva
Author Profile Icon Kamon Ayeva
Kamon Ayeva
Sakis Kasampalis Sakis Kasampalis
Author Profile Icon Sakis Kasampalis
Sakis Kasampalis
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Part 1: Start with Principles FREE CHAPTER
2. Chapter 1: Foundational Design Principles 3. Chapter 2: SOLID Principles 4. Part 2: From the Gang of Four
5. Chapter 3: Creational Design Patterns 6. Chapter 4: Structural Design Patterns 7. Chapter 5: Behavioral Design Patterns 8. Part 3: Beyond the Gang of Four
9. Chapter 6: Architectural Design Patterns 10. Chapter 7: Concurrency and Asynchronous Patterns 11. Chapter 8: Performance Patterns 12. Chapter 9: Distributed Systems Patterns 13. Chapter 10: Patterns for Testing 14. Chapter 11: Python Anti-Patterns 15. Index 16. Other Books You May Enjoy

Conventions used

There are a number of text conventions used and formatting specificities throughout this book.

Most of the code has been automatically formatted

The formatting has been done using the Black tool, as is commonly done by Python developers for productivity reasons. So it might not look exactly like the code you would write yourself. But it is valid; it is a PEP 8-compliant code. The goal is to improve the readability of the code snippets.

So, some code snippets in the code files as well as in the book’s pages may look like the following:

State = Enum(
    "State",
    "NEW RUNNING SLEEPING RESTART ZOMBIE",
)

Another example might be the following:

msg = (
    f"trying to create process '{name}' "
    f"for user '{user}'"
)
print(msg)

The code snippets in the book’s pages may be shortened

To improve readability, when there is a documentation string (docstring) for a function or class, and it is too long, we remove it from the code snippet in the book.

When some code (class or function) is too long to display on the chapter’s pages, we may shorten it, and refer the reader to the complete code in the file.

Note

In case of an issue with long commands, which are spread across several lines (with the ‘/’ character as separator), you can reformat the long command text, removing the ‘/’ character, to make sure that the command is correctly interpreted in the terminal.

Other conventions

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: “Define the Logger interface with a log method.”

A block of code is set as follows:

class MyInterface(ABC):
    @abstractmethod
    def do_something(self, param: str):
        pass

Any command-line input or output is written as follows:

python3.12 –m pip install -–user mypy

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “It is one of the core concepts in object-oriented programming OOP that enables a single interface to represent different types.”

Tips or important notes

Appear like this.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime