You can use generators to simplify nested loops and make it easier to break out of them.
You can use the TeX Paste tool to share LaTeX/MathJax equations across the internet.