-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Mastering Python Design Patterns
By :

These anti-patterns can lead to bugs or unintended behavior if not addressed. We are going to discuss the most common of these anti-patterns and alternative, recommended ways and approaches. We are going to focus on the following anti-patterns:
type()
function for comparing typesNote that using IDEs such as Visual Studio Code or PyCharm or command-line tools such as Flake8 will help you spot such bad practices in your code, but it is important to know the recommendations and the reason behind each one.
Sometimes, we need to identify the type of a value through comparison, for our algorithm. The common technique one may think of for that is to use the type()
function. But using type()
to compare object types does not account for subclassing and is not as flexible as the alternative which is based on...