About 9,680,000 results
Open links in new tab
  1. 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() …

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

  3. 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 calling a def () inside of def () - Stack Overflow

    Aug 1, 2018 · python calling a def () inside of def () Asked 7 years, 2 months ago Modified 3 years ago Viewed 31k times

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

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

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

  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. python - Why use def main ()? - Stack Overflow

    Oct 28, 2010 · Variables inside def main are local, while those outside it are global. This may introduce a few bugs and unexpected behaviors. But, you are not required to write a main() …

  9. correct way to define class variables in Python - Stack Overflow

    I noticed that in Python, people initialize their class attributes in two different ways. The first way is like this: class MyClass: __element1 = 123 __element2 = &quot;this is Africa&quot; ...

  10. Explaining Python's '__enter__' and '__exit__' - Stack Overflow

    I saw this in someone's code. What does it mean? def __enter__(self): return self def __exit__(self, type, value, tb): self.stream.close() Here is the complete code. from