python
Stacks, Queues, and Deques: A Practical Deep Dive into collections.deque
Lists make deceptively bad stacks and queues. Here's why collections.deque exists, when to reach for it, and how it behaves under the hood.
python
Lists make deceptively bad stacks and queues. Here's why collections.deque exists, when to reach for it, and how it behaves under the hood.
python
Learn how Python generators work under the hood — lazy evaluation, the yield keyword, generator expressions, yield from delegation, two-way communication with send(), and building memory-efficient data pipelines that scale to millions of items.
python
A practical deep dive into Python f-strings: expressions, the format-spec mini-language for alignment and numbers, the self-documenting = specifier, conversion flags, and the pitfalls that bite in production.
python
Learn to use Python's built-in sqlite3 module the right way: parameterized queries, row factories, transactions with the connection context manager, executemany, custom type adapters, and the pitfalls that bite newcomers.
python
Learn to run external commands from Python the safe, modern way: subprocess.run(), capturing output, timeouts, pipes with Popen, streaming output, and how to avoid shell-injection pitfalls.
News
A process-heavy week after EuroPython: PEP 836 "JIT Go Brrr" answers the Steering Council's six-month deadline, Guido and Jeremy Hylton file PEP 840 on class-namespace name resolution, Python 3.15.0rc1 is due August 4, and Django ships security fixes in 6.0.7 and 5.2.16.
python
Learn how to replace scattered magic strings and integer constants with real, self-documenting enums. This deep dive covers Enum basics, auto(), aliases, methods on members, IntEnum, Flag, StrEnum, the functional API, and the pitfalls that trip people up.
Python tutorials that go beyond the basics - deep dives into the standard library, testing, typing, and async, plus weekly Python news.
Learn how to run Python code in parallel without wrestling with raw threads or processes. This deep dive into concurrent.futures covers thread vs. process pools, futures, as_completed, timeouts, error handling, and the pitfalls that trip people up.
The same request-response mental model powers the browser's fetch() and Python's httpx. Here's what carries over between the two — and where each language draws its own lines.
Naive vs. aware datetimes, time zones with zoneinfo, DST-safe arithmetic, and robust parsing. A practical guide to Python's datetime module and the pitfalls that bite everyone.
Learn httpx, the modern Python HTTP client: query params and JSON, reusable Clients with connection pooling, async requests, sensible timeouts, robust error handling, and streaming large responses without blowing up memory.
Structural pattern matching is more than a switch statement. Learn how match/case destructures sequences, mappings, and objects — plus guards, OR-patterns, and the two gotchas that trip everyone up.
Learn how to write pytest suites that stay fast and readable as they grow: fixtures with proper teardown, parametrization instead of copy-paste, built-in helpers like tmp_path and monkeypatch, and mocking that verifies behaviour rather than faking success.
Learn how asyncio actually works — coroutines, tasks, gather, TaskGroup, timeouts, queues, and cancellation — plus the blocking-call pitfall that quietly ruins most async code, with runnable examples throughout.
Python 3.15.0b4 shipped from the EuroPython sprints on July 18, closing the beta phase. Plus a new PEP from Guido van Rossum on class-scope name resolution, the JIT's six-month clock, and a PSF election deadline you shouldn't miss.
Learn how to turn a throwaway script into a polished CLI with Python's built-in argparse — flags, types, custom validation, mutually exclusive groups, shared parent parsers, and git-style subcommands that dispatch cleanly.
Learn how to use Python's type hints for real: modern union and generic syntax, TypedDict, Protocol, overloads, type aliases, and the pitfalls that trip people up — with runnable examples.
Read, write, append, and safely extract ZIP archives with Python's standard-library zipfile module — compression choices, ZipInfo metadata, in-memory archives, and the path-traversal pitfall that bites almost everyone.
Learn how Python's logging module really works — loggers, handlers, formatters, and levels — plus dictConfig, rotating files, structured JSON logs, and the pitfalls that trip up almost everyone.