I often require a wrapping integer type in Python, by which I actually mean a subclass of
int
where all operations are performed modulo some constant number $N$. There are two main use cases for this:
1. Working in a finite field for some cryptographic stuff, or solving problems on [Project Euler](https://projecteuler.net/about).
2. Having Python integers behave like machine registers (8, 16, 32, 64, even 128 bits - you name it.)
I decided to solve this once and for all and wrote the integer wrapper class to end all integer wrapper classes. I also managed to keep it rather compact by using *»gasp«* metaclassing.
Do you want to know more?