Posts
26 Jun 2025
Fluent Python Chapter 5: Data Class Builders
A “Data class” is a coding pattern featuring a collection of fields with little or no extra functionality.
This chapter covers three data class builders: collections.namedtuple
, typing.NamedTuple
and @dataclasses.dataclass
Overview of Data Class Builders #
Consider the following Coordinate
class:
class Coordinate:
def __init__(self, lat, lon):
self.lat = lat
self.lon = lon
Notice that if we were to add another attribute, we will need to mention it three times.
Also string representation and comparison between objects do not work the way we expect:
14 Jun 2025
Fluent Python Chapter 4: Unicode Text Versus Bytes
The binary sequence types and codecs
7 Jun 2025
Fluent Python Chapter 3: Dictionaries and Sets
This chapter surveys the various mappings and sets available in the Standard library.
29 May 2025
An archive of material I went through this year
29 May 2025
Things I want to learn in 2025
29 May 2025
Overview of courses enrolled in uni
I took many great courses in uni - here’re some of my favorites
24 May 2025
Fluent Python Chapter 2: An Array of Sequences
A survey of the standard library sequence types, mutability and immutability, list comprehension, tuple unpacking, pattern matching, and more
22 May 2025
Fluent Python Chapter 1: The Python Data Model
This chapter is an introduction to how data objects are represented in Python. For custom objects, by implementing special ‘dunder’ methods, they can behave just like the built-in types like str
and int
.