About 8,650,000 results
Open links in new tab
  1. What is a DEF function for Python - Stack Overflow

    Sep 10, 2013 · I am new to coding Python and I just can't seem to understand what a Def function is! I have looked and read many tutorials on it and I still don't quite understand. Can somebody …

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

    As is, it does absolutely nothing. 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 …

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

  4. python - Why do some functions have underscores - Stack Overflow

    May 24, 2024 · The other respondents are correct in describing the double leading and trailing underscores as a naming convention for "special" or "magic" methods. While you can call …

  5. "TypeError: 'type' object is not subscriptable" in a function signature

    Aug 18, 2020 · The following answer only applies to Python < 3.9 The expression list[int] is attempting to subscript the object list, which is a class. Class objects are of the type of their …

  6. .def files C/C++ DLLs - Stack Overflow

    Jul 21, 2014 · The advantage of def file is that, it helps you to maintain the backword compatibility with the already realsed dlls. i.e it maintains the ordinal numbers for apis. Suppose you add a …

  7. How do I define a function with optional arguments?

    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 may want, we shall just use *args which shall be a list of more …

  8. python - Error: Invalid Syntax on "def" - Stack Overflow

    Jan 16, 2014 · Error: Invalid Syntax on "def" Asked 14 years, 3 months ago Modified 11 years, 9 months ago Viewed 31k times

  9. Groovy: what's the purpose of "def" in "def x = 0"?

    Oct 9, 2008 · Using the def keyword in larger programs is important as it helps define the scope in which the variable can be found and can help preserve encapsulation. If you define a method …

  10. How do I call a function from another .py file? [duplicate]

    function(a, b) Note that file is one of Python's core modules, so I suggest you change the filename of file.py to something else. Note that if you're trying to import functions from a.py to a file …