https://mathspp.com/blog
13 posts
Tech
Subscribe via RSS
Replay the EuroPython 2026 Python quiz. These are the questions asked during the EuroPython 2026 quiz. They will test your knowledge of the Python language, the community, and of EuroPython 2026. Since we were celebrating 25 years of EuroPython at EuroPython 2026, some questions also touched on that theme. (Unless explicitly stated, questions refer to CPython 3.14.) Note that the version of the quiz presented here is less interactive than the one presented at the conference. Questions In 25…
Cheatsheet with visual diagrams that explain how the iterables from itertools work. This cheatsheet contains diagrams that explain how the iterables from the module itertools work in a visual way. Download this cheatsheet Download this cheatsheet
Improve the capabilities of your agent by providing it with better tools. Introduction This tutorial builds on the coding agent you implemented in the tutorial “Write a coding agent from first principles”. In this tutorial, you'll take your agent and improve its capabilities by implementing the text edit and bash command tools that Anthropic provides. Why use Anthropic's tools? In the previous tutorial you implemented a coding agent that has a few tools that it can use to read, write, and…
Learn how to write a coding agent in Python in this tutorial that teaches how to interact with an LLM through an API, how to manage the context, and how to do tool calling. Introduction This tutorial will show you how to create your own coding agent from first principles. By doing so, you'll understand how coding agents work under the hood. Prerequisites To be able to follow this tutorial, you'll need prior Python experience: this tutorial is not suitable for people who don't have programming…
Today I learned that collections.deque is implemented as a doubly-linked list of blocks. collections.deque I've written about the data structure deque from the module collections extensively. In particular, I wrote a deque tutorial with plenty of practical example use cases of deque. Today, after some discussion during a cohort I was teaching, a student sent a link to the collections.deque source code where a comment explains some of the lower-level details of how a deque is implemented.…
Today I learned Python 3.15 will get a new sentinel built-in. Sentinel values are unique placeholder values that are commonly used in programming. Python 3.15 ships with a new built-in sentinel that can be used to create new sentinel values: # Python 3.15+ >>> MISSING = sentinel("MISSING") >>> MISSING MISSING Before this PEP, the most common sentinel idiom used the built-in object: MISSING = object() def my_function(some_arg=MISSING): if some_arg is MISSING: ... # Handle the sentinel In the…
Learn how to work around the Python machinery to resolve an explicit lazy import manually. A couple of articles ago I wrote about how you could inspect a lazy import. Apparently, you can use a similar trick to check the attributes and methods that a lazy import has: >>> lazy import json >>> dir(globals()["json"]) ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__',…
In this article I share my personal highlights of PyCon Lithuania 2026. Shout out to the organisers and volunteers This was my second time at PyCon Lithuania and, for the second time in a row, I leave with the impression that everything was very well organised and smooth. Maybe the organisers and volunteers were stressed out all the time — organising a conference is never easy — but everything looked under control all the time...
Play this short quiz to test your Python knowledge! At PyCon Lithuania 2026 I did a lightning talk where I presented a “Who wants to be a millionaire?” Python quiz, themed around iterables. There's a whole performance during the lightning talk which was recorded and will be eventually linked to from here. This article includes only the four questions, the options presented, and a basic system that allows you to check whether...
This article shares two skills you can add to your coding agents so they use uv workflows. I have fully adopted uv into my workflows and most of the time I want my coding agents to use uv workflows as well, like when running any Python code or managing and running scripts that may or may not have dependencies. To make this more convenient for me, I created two SKILL.md files for two of the most common workflows that the coding...
Learn how objects are automatically iterable if you implement integer indexing. Introduction An iterable in Python is any object you can traverse through with a for loop. Iterables are typically containers and iterating over the iterable object allows you to access the elements of the container. This article will show you how you can create your own iterable objects through the implementation of integer indexing. Indexing with...
This article covers a useful LLM pattern where you ask the LLM to write code to solve a problem instead of asking it to solve the problem directly. The problem of merging two transcripts I had two files that contained two halves of the transcript of an audio recording and I wanted to use an LLM to merge the two halves. There were three reasons that stopped me from simply copying part 2 and pasting it after part 1: the two tra...
See an animation of a trapezoid innscribed in a circle, built with some maths and the help of an LLM. The animation My brother asked for my help to build an animation of a trapezoid inscribed in a circle that kept changing his shape. With a bit of maths and the help of ChatGPT for the UI, I created the animation you can see below. Under the animation you can find a control panel that allows you to tweak some animation paramete...