About 4,790,000 results
Open links in new tab
  1. How can I return two values from a function in Python?

    I would like to return two values from a function in two separate variables. What would you expect it to look like on the calling end? You can't write a = select_choice(); b = select_choice() …

  2. python - How to get the return value from a thread? - Stack …

    Mar 18, 2023 · 333 In Python 3.2+, stdlib concurrent.futures module provides a higher level API to threading, including passing return values or exceptions from a worker thread back to the main …

  3. python - Return multiple columns from pandas apply () - Stack …

    For example, can I instead of returning one column at a time from apply and running it 3 times, can I return all three columns in one pass to insert back into the original dataframe? The other …

  4. python - How to return a subset of a list that matches a condition ...

    How to return a subset of a list that matches a condition [duplicate] Asked 9 years, 9 months ago Modified 2 years, 5 months ago Viewed 101k times

  5. python - How do I get ("return") a result (output) from a function?

    We can make a tuple right on the return line; or we can use a dictionary, a namedtuple (Python 2.6+), a types.simpleNamespace (Python 3.3+), a dataclass (Python 3.7+), or some other …

  6. python - Is it correct to use a return statement within a try and ...

    Other possibilities would be to return a "default value" (empty map in this case) or to "reraise" the exception using except ValueError, e: print "error", e raise It depends on how the function is …

  7. python - Why does "return list.sort ()" return None, not the list ...

    Python built-ins stick to one or the other; methods on immutable types like str do chain (they can't mutate in place, so they return a new object with the mutation applied), while most methods on …

  8. Mocking python function based on input arguments

    If side_effect_func is a function then whatever that function returns is what calls to the mock return. The side_effect_func function is called with the same arguments as the mock.

  9. python - Return in Recursive Function - Stack Overflow

    The return statement neither knows nor cares whether it's returning from a recursively invoked function, it behaves exactly the same way in either case. In fact, recursion isn't anything …

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

    What does the return statement do? How should it be used in Python? How does return differ from print? See also Often, people try to use print in a loop inside a function in order to see …