Code Hard

Python and WebSockets 101: Real-time Communication

Introduction WebSockets enable real-time, bi-directional communication between a client and a server over a single, long-lived connection. This article delves into how to work with WebSockets in Python, avoiding web frameworks to focus purely on the tech itself. Table of Contents 1. What are WebSockets? 2. Python's websockets Library 3.

Doctest 101: Write Tests as You Write Code

When it comes to writing tests for your Python code, doctest offers an easy, readable, and Pythonic way to go about it. In this guide, we'll take a deep dive into how you can use doctest to write test cases right in your docstrings, making your code self-testing and more robust.

The Python Pitfall: Why You Shouldn't Modify Lists During Iteration

Introduction Hello fellow Python enthusiasts! Today, we'll delve into a common pitfall that catches even experienced developers off guard: modifying a list while iterating over it. If you've ever found yourself scratching your head over unexpected results after trying to modify a list in a loop, this blog post is

Code Hard © 2026