About 346,000 results
Open links in new tab
  1. How do nested functions work in Python? - Stack Overflow

    Programmer’s note: Functions are first-class objects. A 'def' form executed inside a function definition defines a local function that can be returned or passed around. Free variables used …

  2. Basic explanation of python functions - Stack Overflow

    Sep 5, 2015 · It also allows you do write more generic, flexible, and reusable code. For example, you don't have to write many different versions of a function to accomplish the same task with …

  3. Does the order of functions in a Python script matter?

    Jun 8, 2017 · It doesn't matter in which order the functions are created. It only matters when the call to the function is done: def print_sum(a, b): print(sum_numbers(a, b)) def sum_numbers(a, …

  4. python - Why do some functions have underscores - Stack Overflow

    May 24, 2024 · From the Python PEP 8 -- Style Guide for Python Code: Descriptive: Naming Styles. The following special forms using leading or trailing underscores are recognized (these …

  5. Why is my Python function not being executed? - Stack Overflow

    Apr 15, 2015 · Python doesn't call any functions on starting unless explicitly asked to (including main). Instead Python names the files being run, with the main file being run called __main__. …

  6. python - How can I use a global variable in a function? - Stack …

    Jul 11, 2016 · Python follows C in having only functions, and global variables generally imply side effects. An idiom like x = f(x) where f returns x, rather than f() with a "global x" declaration, is …

  7. Understanding generators in Python - Stack Overflow

    May 20, 2018 · † About Python <=2.6: in the above examples next is a function which calls the method __next__ on the given object. In Python <=2.6 one uses a slightly different technique, …

  8. python - What is the purpose of the return statement? How is it ...

    Then we tell Python to do something kind of backward: we return the addition of a + b. You might say this as, "I add a and b then return them." Python adds the two numbers. Then when the …

  9. Order of execution and style of coding in Python

    Python does, in general, process commands from top to bottom. However, a function call will cause Python to execute that function, and continue downward only after that call has ended. …

  10. What does -> mean in Python function definitions? - Stack Overflow

    Jan 17, 2013 · In more detail, Python 2.x has docstrings, which allow you to attach a metadata string to various types of object. This is amazingly handy, so Python 3 extends the feature by …

Refresh