Contribute Media
A thank you to everyone who makes this possible: Read More

Hidden Treasures in the Standard Library


Hidden Treasures in the Standard Library

Presented by Doug Hellmann

This presentation covers features of the standard library not widely known or used. Each feature is presented with a short demonstration program and explanation.


The standard library contains many hidden gems that are not widely used, either because they are not publicized enough or because they are deep in a module that programmers haven't had cause to study or use. This presentation covers 8-10 selected topics of this nature in about 25 minutes (leaving time for a couple of questions). Demonstration code is included for every item.

Possible tips include, in no particular order:

  • Using hmac to verify pickled data before unpacking it.
  • Using uuid4 to generate session tokens.
  • Regular expression look-ahead/behind matches.
  • pdb startup files
  • Reading files with mmap
  • Using csv dialects
  • The robotparser module
  • The rlcompleter module
  • Using locale to format numbers and currency
  • The cgitb module
  • pkgutil.getdata
  • contextlib.contextmanager
  • The cmd module
  • The fileinput module
Improve this page