When working on bitcoin and elliptic curve stuff I wrote some code to make the calculations easily understandable
The repository can be found on github
My basic idea is that values are associated with numberfields, in a way that calculations are automatically performed in within that field, without the need to explicitly specify that field.
Example:
GFp = FiniteField(largeprime)
a = GFp.value(anumber)
b = GFp.value(anothernumber)
# now we can do calculations
print(a*b) # multiply a*b in GFp
print(a/b) # multiply a with the modular inverse of b in GFp