February 17, 2021 by
Mike Built-ins are a somewhat overlooked part of Python. You use them every day, but there are a number of them that get overlooked or just aren't used to their full potential. This article won't be covering all the built-ins in Python, but will focus on the ones that you probably don't use every day. any() […]
Descriptors were introduced to Python way back in version 2.2. They provide the developer with the ability to add managed attributes to objects. The methods needed to create a descriptor are __get__, __set__ and __delete__. If you define any of these methods, then you have created a descriptor. The idea behind the descriptor is to […]
Python provides a great module for creating your own iterators. The module I am referring to is itertools. The tools provided by itertools are fast and memory efficient. You will be able to take these building blocks to create your own specialized iterators that can be used for efficient looping. In this chapter, we will […]
The collections module has another handy tool called defaultdict. The defaultdict is a subclass of Python's dict that accepts a default_factory as its primary argument. The default_factory is usually a Python type, such as int or list, but you can also use a function or a lambda too. Let's start by creating a regular Python […]
Over the weekend, I spent some time rearranging ideas for my latest book such that I have have four specific sections of the book. Here they are: Part I - Intermediate Modules Chapter 1 - The argparse module Chapter 2 - The collections module Chapter 3 - The contextlib module (Context Managers) Chapter 4 - […]