mathspp blog
All of the mathspp blog articles about Python, programming, and mathematics.
- Posts
- 436 from 11 Oct 2017 to 30 Oct 2026
- Posting
- weekly (42 in the last year)
- Kind
- personal blog
2026 36
- Python abi3t: what is it?
- Thread-safe iterators
- 4 upgrades to the Python standard library in 3.15
- Typing improvements in Python 3.15
- TypedDict with extra items
- Module profiling overview
- Tachyon: sampling profiling in Python
- DX improvements in Python 3.15
- Startup configuration files
- Unpacking inside comprehensions
- frozendict built-in
- sentinel built-in
- Explicit lazy imports
- The 5 most exciting new features of Python 3.15
- TIL #146 – Using maturin through uv
- Why OOP exists
- Python quiz: EuroPython 2026 edition
- itertools cheatsheet
- Write a coding agent from first principles: better tools
- Write a coding agent from first principles
- TIL #145 – collections.deque is implemented in blocks
- TIL #144 – Sentinel built-in
- TIL #143 – Resolve a lazy import manually
- Personal highlights of PyCon Lithuania 2026
- Who wants to be a millionaire: iterables edition
- uv skills for coding agents
- Indexable iterables
- Ask the LLM to write code for it
- Cyclic trapezoid animation
- TIL #142 – Cyclic quadrilateral
- TIL #141 – Inspect a lazy import
- TIL #140 – Install Jupyter with uv
- TIL #139 – Multiline input in the REPL
- Remove extra spaces
- Recursive structural pattern matching
- TIL #138 – Custom directives in Jupyter Book
2025 58
- Generalising itertools.pairwise
- TIL #137 – Inline SVGs in Jupyter notebooks
- Floodfill algorithm in Python
- TIL #136 – Publish an EPUB book with Jupyter Book
- Module compression overview
- A generator, duck typing, and a branchless conditional walk into a bar
- TIL #135 – Build the Python documentation
- Functions: a complete reference | Pydon't 🐍
- TIL #134 – = alignment in string formatting
- TIL #133 – Shoelace formula
- TIL #132 – Double factorial
- uv cheatsheet
- TIL #131 – Change casing in search & replace
- Accepting the PSF Community Service Award
- functools.Placeholder
- TIL #130 – Format Python code directly with uv
- TIL #129 – Custom value in dict.fromkeys
- Personal highlights of EuroPython 2025
- PyCon Portugal 2025 programme mafia
- TIL #128 – Matching prefixes and suffixes with regex
- TIL #127 – Dynamically changing the type
- TIL #126 – Hash of infinity
- Python quiz: EuroPython 2025 edition
- TIL #125 – Images in docstrings
- Regex in real life
- Personal highlights of PyCon Italy 2025
- Python quiz: PyCon Italia 2025 edition
- Dipping my toes in metaprogramming
- Who wants to be a millionaire?
- TIL #124 – Thousands separators
- Personal highlights of PyCon US 2025
- Automatically pushing code changes during live coding with uv
- TIL #123 – The appearing built-in
- TIL #122 – CLI tools with extra dependencies
- Module enum overview
- TIL #121 – uv escape hatch
- TIL #120 – Circle vs rectangle collision detection
- Binary search as a bidirectional generator
- JavaScript 2D scrolling game tutorial
- TIL #119 – Co-authored commits
- TIL #118 – git checkout -
- TIL #117 – Publishing a Python package with uv
- Beating LinkedIn “Queens” with Python
- Building a Python compiler and interpreter – 10 elif and else
- Using uv to build and install Python CLI apps
- Ignoring exceptions with contextlib.suppress
- TIL #116 – Run commands inside Jupyter notebooks
- TIL #115 – Nested Easter eggs
- TIL #114 – Implicit casting in dataframe concatenation
- TIL #113 – Standalone executable Python scripts with uv
- Using an LLM to write a countdown timer
- TIL #112 – re.Match.groupdict
- functools.cmp_to_key
- Decorators | Pydon't 🐍
- TIL #111 – Interrupting scripts without tracebacks
- TIL #110 – Hash of -1 is -2
- Animating a tree fractal
- TIL #109 – Unpacking kwargs with custom objects
2024 49
- Reverse-engineering the “Chronospatial Computer”
- TIL #108 – Date sequences in Polars
- Solving “Bridge Repair” in 4ms with Python
- TIL #107 – Automatically activating virtual environments
- Parsing TXRX files in Python
- TIL #106 – asyncio.gather
- TIL #105 – pytest selection arguments for failing tests
- Teaching the world's largest programming lesson
- How I prepare a technical talk
- TIL #104 – nested makefiles
- mutability and random.shuffle
- Problem #066 – regex crossword
- Automatic site updates with cog and pre-commit
- Customising object creation with __new__
- Case-insensitive string class
- Module itertools overview
- TIL #103 – debugging the new Python REPL with trace and PYREPL_TRACE.
- TIL #102 – ctrl+left and ctrl+right not working in the Python REPL on MacOS
- Animating a rotating spiral
- TIL #101 – difference between __getattr__ and __getattribute__
- TIL #100 – Making an iterator out of a function
- Breaking out of nested loops with generators
- TIL #099 – order values of dictionary by iterable of keys with operator.itemgetter
- TIL #098 – Git alias for quick commit & push
- ASCII rain scroll art
- TIL #097 – get terminal size
- TIL #096 – automatically push code changes during live coding
- Sets as dictionaries with no values
- TIL #095 – better test parametrisation in pytest
- TIL #094 – pytest.raises: parameter match
- A tutorial is not a long talk
- Hold my parentheses light: now with zero sugar
- Hold my parentheses
- 503 days working full-time on FOSS: lessons learned
- Longest unique substring
- TIL #093 – operator.methodcaller
- TIL #092 – dunder method __init_subclass__
- TIL #091 – issue user warnings
- Deducing physics formulas with genetic algorithms
- Biggest square
- N queens problem
- TIL #090 – patching module globals with pytest
- Python deque tutorial
- Problem #065 – clock synchronisation
- Dynamic string replacements with regex
- Base conversion in Python
- max is broken
- functools.partial
- Problem #064 – infinite mathematicians with hats
2023 81
- Learn pandas and matplotlib with Pokémon
- Manipulate Boolean values with conditions
- divmod for unit conversions
- What is *args and how do you use it?
- Building a Python compiler and interpreter – 09 short-circuiting
- Why use enums?
- 5 ways to flatten a list of lists
- TIL #089 – delete merged git branches
- Secret Santa draw with Python
- In conversation: Rodrigo and Stephen discuss analogies when learning to code
- Python Black Friday 2023
- Building a Python compiler and interpreter – 08 Booleans
- TIL #088 – Python's soft keywords
- TIL #087 – underscore is a soft keyword
- Single-line calculator
- Building a Python compiler and interpreter – 07 if
- Building a Python compiler and interpreter – 06 variables
- Building a Python compiler and interpreter – 05 statements
- Building a Python compiler and interpreter – 04 arithmetic
- Building a Python compiler and interpreter – 03 visitor pattern
- Building a Python compiler and interpreter – 02 numbers
- TIL #086 – run custom code on Python start-up
- Building a Python compiler and interpreter
- itertools.batched
- TIL #085 – negative zero -0.0
- TIL #084 – type statement and type aliases
- Adding stats to my blog
- TIL #083 – sentinel value for default arguments
- (More) Animations from first principles
- Animations from first principles
- TIL #082 – 20 million lines of Python code
- TIL #081 – find commits that affected a file
- TIL #080 – how to draw a Bézier curve
- TIL #079 – Textual app notifications
- TIL #078 – context variables
- Module pathlib overview
- TIL #077 – piece table data structure
- What learning APL taught me about Python
- TIL #076 – Hypothesis for code refactoring
- TIL #075 – Damerau-Levenshtein distance
- Overloading arithmetic operators with dunder methods | Pydon't 🐍
- All functions return something
- TIL #074 – crazy Python indentation
- TIL #073 – customise the REPL on start-up
- TIL #072 – read bytecode from a .pyc file
- TIL #071 – generator method close
- TIL #070 – writing and running tests in Rust
- TIL #069 – generator membership testing
- Textual for beginners
- TIL #068 – nested git repositories
- TIL #067 – VS Code extension for custom syntax highlighting
- TIL #066 – activate virtual environment with alias
- TIL #065 – VS Code sticky scroll
- TIL #064 – open recursion
- Describing Descriptors | Pydon't 🐍
- TIL #063 – skip tests on Microsoft Windows
- Properties | Pydon't 🐍
- How to use modal screens in Textual
- TIL #062 – dbg! macro for debugging in Rust
- Write a Python module in Rust
- TIL #061 – debugging other modules in VS Code
- TIL #060 – how to rename a git branch
- TIL #059 – skip list data structure
- TIL #058 – do not cache generators
- TIL #057 – optimising images for the web
- Write your thesis in LaTeX
- Streaming data from Flask to HTMX using Server-Side Events (SSE)
- ChatGPT for quick prototyping
- Textual tutorial – build a TODO app in Python
- VS Code shortcuts for efficient Python programmers
- TIL #056 – invisible variables
- Converting RAW images into JPEG
- TIL #055 – xkcd plots
- Your first recurrent neural network (RNN)
- Module collections overview
- Finding similar photos
- Implementing a case-insensitive dictionary
- Problem #063 – arbitrarily many primes in arbitrarily big intervals
- Finding and fixing over 10,000 bugs on GitHub
- Connecting Python and Dyalog APL with sockets
- How to work with case-insensitive strings
2022 64
- Running Python inside ChatGPT
- TIL #054 – type hint Any
- TIL #053 – precision of Python floats
- TIL #052 – deleting a file with pathlib
- TIL #051 – Heron's formula
- TIL #050 – add a suggestion
- TIL #049 – edit multiple file locations in VS Code
- How to create a Python package in 2022
- Smoosh all the things
- Obfuscated "Hello, world!"
- The most obscure "Hello, world!" program
- Object initialisation with __init__
- Dunder methods | Pydon't 🐍
- Custom JSON encoder and decoder
- TIL #048 – custom JSON decoder, part 2
- Problem #062 – sliding coins
- TIL #047 – custom JSON decoder
- TIL #046 – custom JSON encoder
- Problem #061 – flower garden
- Problem #060 – realtor commissions
- TIL #045 – using JavaScript functions in PyScript
- TIL #044 – PyScript
- TIL #043 – rich traceback and exception logging
- TIL #042 – how to do beautiful console logging
- TIL #041 – how to commit part of a file with git
- Contributing to open source: rich 2073
- Problem #059 – marching pegs
- TIL #040 – code syntax highlighting in Microsoft PowerPoint
- Problem #058 – identifying light bulbs
- Solving Wordle with APL
- Why APL is a language worth knowing
- Look-and-say sequence
- TIL #039 – how to install starship
- TIL #038 – look-and-say sequence growth
- TIL #037 – pandas Series
- Problem #057 – how to find the circle centre
- TIL #036 – pandas show_versions
- TIL #035 – run black formatter on pre-commit
- TIL #034 – multi-channel transposed convolution
- Enumerate from first principles
- TIL #033 – transposed convolution
- Problem #056 – tennis tournament
- TIL #032 – t-SNE for dimensionality reduction
- TIL #031 – understanding SVG viewBox
- TIL #030 – Simpson's paradox
- TIL #029 – True is equal to 1
- Problem #055 – horse racing
- 50 shades of sign
- TIL #028 – disassemble Python.
- TIL #027 – get rich with Python.
- Elo rating system simulation
- TIL #026 – web apps with streamlit
- Problem #054 – imperfect compression
- TIL #025 – reversed emoji flags
- TIL #024 – cooking with asyncio
- Chatroom server tutorial
- TIL #023 – how to use namedtuple
- TIL #022 – Python module selectors
- Sockets for dummies
- TIL #021 – Spouge's formula
- Problem #053 – weighing the odd one out
- TIL #020 – open(0)
- TIL #019 – sockets
- Solving Wordle with Python
2021 90
- Problem #052 – chessboard domino
- TIL #018 – suppressing errors with contextlib
- Problem #051 – queens and knights
- Why mastering Python is impossible, and why that's ok | Pydon't 🐍
- Advent of Code: sonar sweep analysis
- TIL #017 – symmetrical indexing with bitwise inversion
- Problem #050 – 8 queens
- TIL #016 – Quicksort in functional programming
- Minimax algorithm and alpha-beta pruning
- String formatting comparison | Pydon't 🐍
- TIL #015 – DARPA network challenge
- Counting mosaics with APL
- Problem #049 – coin pyramid
- TIL #014 – reading files with pathlib
- Pass-by-value, reference, and assignment | Pydon't 🐍
- TIL #013 – dunder method __eq__
- Problem #048 – trick or treat
- Problem #047 – surgery gloves
- TIL #012 – At operator for matrix multiplication
- TIL #011 – emojis in Python with pythonji
- TIL #010 – generator return
- TIL #009 – vars
- Problem #046 – triangle grid
- TIL #008 – two pass join
- TIL #007 – math.nextafter
- Conditional expressions | Pydon't 🐍
- TIL #006 – file unpacking
- List comprehensions 101 | Pydon't 🐍
- TIL #005 – string unpacking
- TIL #004 – C3 linearisation
- Problem #045 – 1, 2, 3
- TIL #003 – ICPO rule for attribute lookup
- TIL #002 – fake chess AI
- TIL #001 – ceiling division in Python
- set and frozenset | Pydon't 🐍
- Problem #044 – send more money
- Boost your productivity with the REPL | Pydon't 🐍
- Problem #043 – Rubik's cube scrambling
- String translate and maketrans methods | Pydon't 🐍
- Naming matters | Pydon't 🐍
- Problem #042 – mine captcha
- Neural networks fundamentals with Python – student-teacher
- Problem #041 – canyon crossing
- Code style matters | Pydon't 🐍
- Bite-sized refactoring | Pydon't 🐍
- Problem #040 – the dozen puzzle
- Does elegance matter? | Pydon't 🐍
- __name__ dunder attribute | Pydon't 🐍
- Problem #039 – rope timer
- Usages of underscore | Pydon't 🐍
- Problem #038 – bridges of Königsberg
- The power of reduce | Pydon't 🐍
- Buffet of self-references
- Boolean short-circuiting | Pydon't 🐍
- Problem #037 - game of coins
- Problem #036 - huge, tiny triangle
- Inner workings of sequence slicing | Pydon't 🐍
- Mastering sequence slicing | Pydon't 🐍
- Problem #035 – unknown coin sides
- Neural networks fundamentals with Python – subtleties
- Idiomatic sequence slicing | Pydon't 🐍
- Counting passwords with automatons
- Sequence indexing | Pydon't 🐍
- Problem #034 – one question to happiness
- Enumerate me | Pydon't 🐍
- Problem #033 - syncro
- Let's build a simple interpreter for APL - part 4
- Zip up | Pydon't 🐍
- Problem #032 - restaurant roundtable
- Structural pattern matching anti-patterns | Pydon't 🐍
- Neural networks fundamentals with Python – MNIST
- Structural pattern matching tutorial | Pydon't 🐍
- Problem #031 - piped ants
- Neural networks fundamentals with Python – backpropagation
- Neural networks fundamentals with Python – network & loss
- Chaining comparison operators | Pydon't 🐍
- Neural networks fundamentals with Python – intro
- Deep unpacking | Pydon't 🐍
- Problem #030 - efficiency at the beach
- Watch out for recursion | Pydon't 🐍
- Truthy, Falsy, and bool | Pydon't 🐍
- Problem #029 - hidden key 2 🗝️🗝️
- str and repr | Pydon't 🐍
- What all promotions actually mean
- Assignment expressions and the walrus operator := | Pydon't 🐍
- Problem #028 - hidden key 🗝️
- EAFP and LBYL coding styles | Pydon't 🐍
- Unpacking with starred assignments | Pydon't 🐍
- Problem #027 - pile of coconuts 🥥
- Pydon't disrespect the Zen of Python 🐍
2020 21
- Problem #026 - counting squares
- Problem #025 - knight's tour
- Pydon't Manifesto 🐍
- Problem #024 - hats in a line
- Filling your Pokédex - a probabilistic outlook
- Implementing an interpreter in 14 lines of Python.
- Problem #023 - guess the polynomial
- Twitter proof: consecutive integers are coprime
- Twitter proof: maximising the product with a fixed sum
- Problem #022 - coprimes in the crowd
- Problem #021 - predicting coin tosses
- Let's build a simple interpreter for APL - part 3 - the array model
- My two cents on the 2020 APL competition
- Twitter proof: size of the set of subsets of a set
- YAMLUtils: automating boring stuff with Python
- Studying the "24 Game"
- Problem #020 - make 24 with 3 3 8 8
- Let's build a simple interpreter for APL - part 2
- Problem #019 - fold the alphabet
- Problem #018 - circle of hats
- Let's build a simple interpreter for APL - part 1
2019 8
2018 10
- Problem #011 – salvation of the monks
- Problem #012 – it is just a matter of time
- The birthday bet
- Problem #010 – Alice and the Maths Hatter
- Problem #009 – greedy pirates
- Problem #008 – cutting squares
- Problem #007 - binary multiples
- Problem #006 - stacks of beans
- The CCC of proof methods
- Problem #005 - number me right
2017 19
- Solving mazes with programming
- HueHue: a colourful game
- Problem #004 - solvability of the water buckets
- Water buckets riddle
- Finding all strings a regular expression can find
- Twitter proof: irrational rationality
- Problem #003 - a quarrel in the Shire
- Problem #002 - a bag full of numbers
- Problem #001 - a dancing triangle
- Solving diophantine equations with random walks
- Random walk simulations in 2D
- Egyptian multiplication with Haskell
- Fractals and the filled Julia set
- On recursive functions and Kleene's approach
- Creating a programming language from scratch
- Fractals and the Mandelbrot set
- Pigeon Pooping Simulator
- Minesweeper remake
- A gradient descent algorithm to optimally distribute points over a sphere