What is the difference between a stack and a frame?
问题 Under what situations would I want to use one over the other? What is the difference between: >>> import inspect >>> print(inspect.getouterframes(inspect.currentframe())) [(<frame object at 0x8fc262c>, '<stdin>', 1, '<module>', None, None)] And: >>> import traceback >>> traceback.extract_stack() [('<stdin>', 1, '<module>', None)] Update: Another: >>> import sys >>> print(sys._getframe().f_trace,sys._getframe().f_code) (None, <code object <module> at 0x8682a88, file "<stdin>", line 1>) I do