by Fredrik Håård for EuroPython 2012
The Python Standard Library contains all kinds of useful stuff - healthy, wholesome stuff like a wide array of support libraries for file formats, a web server, easy access to OS services and functional programming tools.
Among those benevolent libraries hide other, darker libraries. They offer tremendous power to anyone who learns how to wield them, but they also carry the threat of destroying your software’s readability, comprehension and very structure.
This session will be a hands-on-keyboard dive into the dark magic parts of the standard library, and participants will learn valid (for a given value of valid) use-cases for practices that will give any software engineering professor nightmares. It focuses on learning by doing, and (evil?) koans are used to teach some of the most ‘clever’ tricks of standard Python.
Modules that will definitely be included are:
* exec
* imp
* inspect
* ast
Modules that may be included depending on time:
* pdb and trace libraries
* gc
Concepts that will be explored include adding or shortcutting behaviors, creating synthetic types and functions, and troubleshooting and/or increasing performance. Some of the things from http://blaag.haard.se/Protocol-specifications-written-in-Python/ regarding imp/inspect will be included and expanded on (parts of this is also a proposal to a regular session at EuroPython).