About 166,000 results
Open links in new tab
  1. python - How do I define a function with optional arguments?

    0 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 …

  2. python - What does ** (double star/asterisk) and * (star/asterisk) …

    Aug 31, 2008 · The function recieving the parameters does not have to know that they are being expanded. For example, Python 2's xrange does not explicitly expect *args, but since it takes …

  3. What do * (single star) and / (slash) do as independent parameters?

    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 …

  4. How do Python functions handle the types of parameters that you …

    Apr 7, 2017 · Python doesn't know that you are calling the function with the proper types, and expects the programmer to take care of that. If your function will be called with different types …

  5. python - How to get method parameter names? - Stack Overflow

    Given that a function a_method has been defined like def a_method(arg1, arg2): pass Starting from a_method itself, how can I get the argument names - for example, as a tuple of strings, …

  6. python - How do I pass a variable by reference? - Stack Overflow

    Jun 12, 2009 · So it seems like parameters in Python are passed by value. Is that correct? How can I modify the code to get the effect of pass-by-reference, so that the output is Changed? …

  7. Getting list of parameter names inside python function

    Therefore, given a python 3 decorator function def decorate(fn): ..., you would simply do fn_params = inspect.signature(fn).parameters in the decorator and use logic to get the …

  8. python - Passing a dictionary to a function as keyword parameters ...

    How to use a dictionary with more keys than function arguments: A solution to #3, above, is to accept (and ignore) additional kwargs in your function (note, by convention _ is a variable …

  9. How to use multiprocessing pool.map with multiple arguments

    @zthomas.nc this question is about how to support multiple arguments for multiprocessing pool.map. If want to know how to call a method instead of a function in a different Python …

  10. How to pass dictionary items as function arguments in python?

    How to pass dictionary items as function arguments in python? [duplicate] Asked 11 years, 8 months ago Modified 5 years, 8 months ago Viewed 321k times