About 50 results
Open links in new tab
  1. What does -> mean in Python function definitions?

    Jan 17, 2013 · 744 It's a function annotation. 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 …

  2. python - Python3 function definition, arrow and colon - Stack …

    Feb 6, 2019 · The use of -> None indicates that the function does not have a return statement. List[str] is more interesting: The List part indicates it will return a list type, and its argument [str] …

  3. Basic explanation of python functions - Stack Overflow

    Sep 5, 2015 · The same is true of the arguments in the function you've provided. This means that the order of the arguments in a function call is important. The Python language, like many …

  4. Invalid syntax error in Python - Stack Overflow

    Nov 23, 2013 · return x+2 function(5) In python, indentations are important. They are the {} of the python world. You actually do not need to add extra whitespace before function(5) because …

  5. What does the "at" (@) symbol do in Python? - Stack Overflow

    Decorators were added in Python to make (a function that receives a function and returns an enhanced one) easier to read and understand. The original use case was to be able to define …

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

    Aug 31, 2008 · In a function call the '*' unpacks data structure of tuple or list into positional or keyword arguments to be received by function definition. In a function call the '**' unpacks data …

  7. How to know function return type and argument types?

    202 While I am aware of the duck-typing concept of Python, I sometimes struggle with the type of arguments of functions, or the type of the return value of the function. Now, if I wrote the …

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

    Jan 9, 2020 · The function parameter syntax (/) indicates the end of the positional only parameters, which must be specified positionally and can't be used as keyword arguments …

  9. Python class definition syntax - Stack Overflow

    A class definition is a bit different from a function/method definition. The parentheses in class definitions are for defining from which class you inherit. You don't write def in front of it, and …

  10. python - Order of parameters and arguments in function …

    Mar 7, 2014 · At the end of the day studying parameters and arguments in python , I finally made the following conclusion Order of parameters in function definition def foo ( non-optional …