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

    Jan 17, 2013 · In Python 3.5 though, PEP 484 -- Type Hints attaches a single meaning to this: -> is used to indicate the type that the function returns. It also seems like this will be enforced in …

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

    Aug 31, 2008 · Note: A Python dict, semantically used for keyword argument passing, is arbitrarily ordered. However, in Python 3.6+, keyword arguments are guaranteed to remember insertion …

  3. 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 …

  4. python - Is it pythonic for a function to return multiple values ...

    For simple (and usually contrived) examples, it may seem that it's always possible for a given function to have a single purpose, resulting in a single value. However, when using Python for …

  5. How do I measure elapsed time in Python? - Stack Overflow

    The python cProfile and pstats modules offer great support for measuring time elapsed in certain functions without having to add any code around the existing functions.

  6. What does the "yield" keyword do in Python? - Stack Overflow

    Oct 24, 2008 · Then each time you extract an object from the generator, Python executes code in the function until it comes to a yield statement, then pauses and delivers the object. When you …

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

  8. python - How can I change a global variable from within a …

    The a in your first line is a global variable (so called because it exists in the global scope, outside of any function definitions). The a in the other lines is a local variable, meaning that it only …

  9. python - How do I detect whether a variable is a function ... - Stack ...

    Our custom is_function (obj), maybe with some edits is the preferred method to check if an object is a function if you don't any count callable class instance as a function, but only functions …

  10. python - Can a variable number of arguments be passed to a …

    May 28, 2009 · Can a variable number of arguments be passed to a function? Asked 16 years, 5 months ago Modified 4 years, 10 months ago Viewed 510k times