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

    Jan 17, 2013 · 13 def f(x) -> 123: return x My summary: Simply -> is introduced to get developers to optionally specify the return type of the function. See Python Enhancement Proposal 3107 …

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

  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. When does `def` run in python? When will function object be …

    Mar 15, 2017 · -1 def is executed whenever you hit it in parsing the source file. It defines the function. This means that the body of the function is assigned to the name, the parameters are …

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

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

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

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

  9. What does ** (double star/asterisk) and * (star/asterisk) do for ...

    Aug 31, 2008 · See What do ** (double star/asterisk) and * (star/asterisk) mean in a function call? for the complementary question about arguments.

  10. oop - What do __init__ and self do in Python? - Stack Overflow

    Jul 8, 2017 · In this code: class A(object): def __init__(self): self.x = 'Hello' def method_a(self, foo): print self.x + ' ' + foo ... the self variable represents the instance of the object itself. Most …