python Programming Glossary: sys._getframe
Getting the block of commands that are to be executed in the with statement http://stackoverflow.com/questions/12485837/getting-the-block-of-commands-that-are-to-be-executed-in-the-with-statement __exit__ self exc_type exc_value traceback self.ns.update sys._getframe 1 .f_locals my_dict 'a' 3 'b' 2 with MyNameSpace my_dict as..
Can Python determine the class of a object accessing a method http://stackoverflow.com/questions/1497683/can-python-determine-the-class-of-a-object-accessing-a-method from the locals. class Reciever def themethod self frame sys._getframe 1 arguments frame.f_code.co_argcount if arguments 0 print Not..
Undecompilable Python http://stackoverflow.com/questions/15087339/undecompilable-python the locals list in the code object for example. Neuter the sys._getframe function slash traceback information. Both these steps require..
Python string interpolation implementation http://stackoverflow.com/questions/16504732/python-string-interpolation-implementation '' dictionary None if dictionary is None import sys caller sys._getframe 1 dictionary caller.f_locals print string.format dictionary.. import sys def get_scope scope scope scope.lower caller sys._getframe 2 options 'l' 'local' 'g' 'global' if scope not in options 2..
globals and locals in python exec() http://stackoverflow.com/questions/2904274/globals-and-locals-in-python-exec the module scope's locals. exec compile import sys nprint sys._getframe .f_code.co_name blah exec module exec a 1 nclass A object n..
Accessing the name that an object being created is assigned to http://stackoverflow.com/questions/3744792/accessing-the-name-that-an-object-being-created-is-assigned-to than the simple assignment you're looking for. def f f sys._getframe i f.f_lasti 3 # capture current point of execution advance to..
|