About 283,000 results
Open links in new tab
  1. mean in Python function definitions? - Stack Overflow

    Jan 17, 2013 · 743 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 - How to use a variable defined inside one function from …

    However, to write to a global variable within a function, you do have to use the global keyword in front of the variable declaration within the function, or else the function will consider it a …

  3. python - How to put a define inside a define function - Stack …

    Apr 3, 2015 · I am trying to figure out how to put a define function inside a define function inside of a class. Python code of what I want to do: class Guy (): def move (self): def left (self): ...

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

    See the Python documentation for an excellent summary; the various other answers to the question make use of most of these variations. Since you always have parameters a, b, c in …

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

    Apr 7, 2017 · def my_func(param1, param2): # stuff However, you don't actually give the types of those parameters. Also, if I remember, Python is a strongly typed language, as such, it seems …

  6. Python: defining a function inside of a function - Stack Overflow

    To be more general, they "do something" with the passed in method/function. That my include calling it and return its result, iterating over it and returning the resulting joined string, or, as …

  7. What is a DEF function for Python - Stack Overflow

    Sep 10, 2013 · 14 def isn't a function, it defines a function, and is one of the basic keywords in Python. For example:

  8. python - What does def main () -> None do? - Stack Overflow

    It is a type annotation for the main function that simply states that this function returns None. Type annotations were introduced in Python 3.5 and are specified in PEP 484. Annotations for the …

  9. python - How to stop a function - Stack Overflow

    A simple return statement will 'stop' or return the function; in precise terms, it 'returns' function execution to the point at which the function was called - the function is terminated without …

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

    def f(): pass; pass 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 …