The Python Quick Reference

I uploaded a new version of my Python Quick Reference. You can access it by clicking on the top menu. The Python cheat sheets I found on the internet were either too long, not too pretty, or didn’t have the source available so I could change it to fit my taste.


I designed the Python Quick Reference using LaTeX. I used common packages like color, multicol, and graphicx to have colored text, four columns, and to insert the python logo. I used beramono — a “version of Bitstream Vera Mono slightly enhanced for use with TeX” — and utopia to have better looking fonts. I used the tikz package to create the round boxes that separate each section.

The box creation is abstracted in the \header macro:

With this macro I can create each section with a command like \header{Built-in functions}. Simple and easy 😉

Finally, I used the dirtree package to display the built-in exceptions hierarchy as a tree:


I like using something like LaTeX and dirtree because I can copy the exception hierarchy from the Python documentation and have LaTeX display it for me. If the list changes, it’s easier to update it than if I was using a graphical program. On the other hand I’m not 100% satisfied with the result, so I’m looking for another tree package for LaTeX. If you know one that might be good, let me know in the comments.

If you want something more substantial (and yet short), maybe the Python Pocket Reference is what you’re looking for. In addition to paper, it’s available in pdf, epub, and kindle (mobi) formats. (Disclaimer: I don’t have any affiliation with O’reilly and the above link it’s not an affiliate link.)

That’s it, a simple and good looking cheat sheet in minutes, courtesy of LaTeX. I may include a third page in the future with some useful functions from the standard library. There are also things that I didn’t figure out how to display in a short space, like data structures, iterators and generators. Please let me know in the comments if you have any ideas or suggestions.

UPDATE: Sarabander implemented some fixes and improvements (Thanks!). Go grab the new version.

  • Ayesha

    Wow.. It’s actually too good to know n understand about a new course .