On Fri, Mar 7, 2014 at 6:45 AM, Danny Yoo <d...@hashcollision.org> wrote: > > Although many of the recommendations have been discouraging the stack > inspection approach, even stack inspection might be appropriate, > though it's certainly not a technique for beginners.
Stack inspection is really intended for debugging or logging. The stack frame functions in the inspect module really shouldn't be used for program logic. The warning in the docs about inspect.currentframe applies equally to inspect.stack. These functions rely on sys._getframe, which is a CPython implementation detail. PyPy and Jython do support sys._getframe. IronPython 2.6 added the command-line options -X:Frames and -X:FullFrames to support sys._getframe, but its design using the DLR doesn't require frame objects. Creating them is extra work and probably degrades performance (definitely for FullFrames). _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor