About 10,600,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. 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 …

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

  4. python - Differences between `class` and `def` - Stack Overflow

    What is the main difference between class and def in python? Can a class in python interact with django UI (buttons)?

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

  6. function - what is "def" in Java class - Stack Overflow

    Jan 14, 2021 · while googling, I find that "def" is used in python and groovy language. But, I am using java. So, how come it is possible to use keywords like "def" in java class? Is it possible to …

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

    Oct 9, 2008 · However, variables defined using the keyword "def" are treated as local variables, that is, local to this one script. Variables without the "def" in front of them are stored in a so …

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

    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 these methods directly …

  9. Using len () and def __len__ (self): to build a class

    Feb 27, 2013 · Just curious, Is there any difference (advantages and disadvantages) between using len () or def __len__ () when I build a class? And which is the best Python style? class foo …

  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 …