OOP

Object-oriented programming concepts: classes, objects, inheritance, encapsulation, and polymorphism.

Python: Asyncio, async/await for I/O Concurrency

Here is a puzzle. You fire off ten network requests, each one takes about a second, and the whole thing finishes in one second flat. No extra threads. No extra Central Processing Unit (CPU) cores. Just one thread, running one task at a time. How? Welcome to Python asyncio, where a single thread juggles thousands of waiting operations by never sitting idle. “Concurrency is about structure, parallelism is about execution.” Rob Pike, Concurrency Is Not Parallelism Last Updated: July 2026 ... Read More

Python: Dataclasses vs Pydantic vs attrs (Which Data Class Library?)

You define a tidy class to hold a user’s data, then a bad API response slips a string in where the age should be, and nothing complains until it crashes three functions later. That silent failure is exactly where the dataclasses vs pydantic question earns its keep. This guide builds one User model three ways with dataclasses, Pydantic, and attrs, then lines them up on validation, speed, and JSON so you can choose with confidence. “Dataclasses are a code generator. ... Read More

Python: Dataclasses, Modern Data Containers

A Python dataclass writes the boring parts of a class for you: the __init__, the __repr__, and the __eq__. You declare the fields once with type annotations, add @dataclass on top, and Python fills in the rest. This post is a recipe book of dataclass patterns: simple defaults, mutable default factories, frozen immutability, computed fields with __post_init__, and the memory savings from slots. “The best code is the code you never had to write.” Jeff Atwood, Coding Horror Last Updated: ... Read More