for the record, googling for "f_back.f_locals" reveals a wide variety of similar hacks and also a cleaner way to access the current frame: inspect.currentframe()