About 105,000 results
Open links in new tab
  1. What does -> mean in Python function definitions? - Stack Overflow

    Jan 17, 2013 · Simply -> is introduced to get developers to optionally specify the return type of the function. See Python Enhancement Proposal 3107. This is an indication of how things may …

  2. python - Position of defining a function - Stack Overflow

    Dec 18, 2021 · You can define a function in Python anywhere you want. However , it won't be defined, and therefore callable, until the function definition is executed. If you're familiar with …

  3. Basic explanation of python functions - Stack Overflow

    Sep 5, 2015 · For example, consider the function f(x, y) = x - y. If this function is called as z = f(3, 4) then the argument by the name of x will receive the value 3 and y will be 4, to return -1. If …

  4. python - How to end a definition of a function? - Stack Overflow

    Jan 2, 2014 · If you're working in IDLE or the Python shell, hit Enter twice to get back to the >>> prompt, then begin your next function definition. The only time you wouldn't do this is if you …

  5. python - How do I define a function with optional arguments?

    A Python function can take in some arguments, take this for example, def add(x,y): return x+ y # calling this will require only x and y add(2,3) # 5 If we want to add as many arguments as we …

  6. python - Define functions with too many arguments to abide by …

    May 5, 2020 · 1) to parse a module full of functions, the eye has to constantly shift where it's scanning horizontally (unless all your function names are the same length ;) ). 2) Adding an …

  7. python - Change function definition based on condition - Stack …

    Jan 3, 2019 · Python changing function definition in loop? 0. Python: Changing a pre-defined variable inside if a ...

  8. How does Python know where the end of a function is?

    The three forms above show how the end of a function is defined syntactically. As for the semantics, in Python there are three ways to exit a function: Using the return statement. This …

  9. python - What do * (single star) and / (slash) do as independent ...

    Jan 9, 2020 · The function parameter syntax(/) is to indicate that some function parameters must be specified positionally and cannot be used as keyword arguments.(This is new in Python …

  10. python - How do I forward-declare a function to avoid …

    In python the statement globals()[function_name]() is the same as foo() if function_name = 'foo' for the reasons discussed above, since python must lookup each function before calling it. If one …

Refresh