About 521,000 results
Open links in new tab
  1. Explain the concept of a stack frame in a nutshell

    Apr 7, 2012 · A stack frame is a frame of data that gets pushed onto the stack. In the case of a call stack, a stack frame would represent a function call and its argument data. If I remember correctly, the function return address is pushed onto the stack first, then the arguments and space for local variables.

  2. Understanding the Function Call Stack in Python: A …

    The function call stack (often simply called the call stack ) is a data structure that keeps track of active function calls in a program. It operates as a stack —a Last-In-First-Out (LIFO) structure—where each function call pushes a new frame onto the …

  3. python - global frame vs. stack frame - Stack Overflow

    when you call a function, a frame is created for the local execution. When a module is loaded, a frame is created for the global module execution.

  4. Distinguishing Stacks and Frames in Python 3 Programming

    Apr 22, 2024 · A frame, also known as a function call frame or activation record, is a data structure used to store information about a function call. In Python, each time a function is called, a new frame is created to store the local variables, arguments, and the return address.

  5. Scope, Frame and Stack — Understanding Recursion Using Python

    Every time we call (as opposed to merely define) a function, a new frame is created, and is added to the stack. At the same time, the flow of control passes to that frame. The usual analogy is a stack of cafeteria trays: the global frame is the first tray.

  6. Understanding how stack frames work in recursive function

    Jun 3, 2015 · Let's say we have the following recursive function that reverses the characters in a string: if len(text) <= 1: return text. return reverse_string(text[1:]) + text[0] which outputs: olleh. I'm thinking that the frames for the reverse_string(text[1:]) work as follows:

  7. 18.9: Stack Diagrams for Recursive Functions

    In Section 3.10, we used a stack diagram to represent the state of a program during a function call. The same kind of diagram can help interpret a recursive function. Every time a function gets called, Python creates a new function frame, which contains the …

  8. 5.6. Stack Frames: Implementing Recursion — Problem Solving …

    When a function is called in Python, a stack frame is allocated to handle the local variables of the function. When the function returns, the return value is left on top of the stack for the calling function to access.

  9. Python Tutorial: How to Call Stack in Python Algorithms?

    Oct 25, 2024 · The call stack is a stack data structure that keeps track of function calls in a program. Each time a function is called, a new frame is pushed onto the stack, containing information such as local variables, parameters, and the return address.

  10. Python Stack Data Structure: When and Why to Use it

    Apr 17, 2025 · A stack in Python is a type of collection used to organize and manage data in a specific order. Elements in a stack are added and removed from only one end, called the top. ... Function Calls and Recursion (Call Stack): During program execution, each function call is placed on a stack. When a function finishes, it’s removed (popped) from the ...

  11. Some results have been removed
Refresh