pycon logo

PyCon 2011 Atlanta

March 9th–17th

Log in or Sign Up

Hidden Treasures in the Standard Library

log in to bookmark this presentaton

Experienced / Talk
March 13th 1:55 p.m. – 2:25 p.m.
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