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

    Jan 17, 2013 · funcdef: 'def' NAME parameters ['->' test] ':' suite The optional 'arrow' block was absent in Python 2 and I couldn't find any information regarding its meaning in Python 3. It …

  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. Why should we use -> in def __init__ (self, n) -> None:?

    Nov 20, 2020 · It comes down to the fist sentence in PEP 484 - The meaning of annotations Any function without annotations should be treated as having the most general type possible, or …

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

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

  6. When does `def` run in python? When will function object be …

    Mar 15, 2017 · 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 …

  7. How can I use a global variable in a function? - Stack Overflow

    Jul 11, 2016 · You may want to explore the notion of namespaces.In Python, the module is the natural place for global data:. Each module has its own private symbol table, which is used as …

  8. How to use the def function in IF or ELSE/ ELIF satement in python?

    Jan 3, 2016 · I have a sub program that uses a def option, so if i ever want to repeat the program. Eg: def op1(): print ("Something Something") So I just write in the program: op1() which makes …

  9. How to determine whether a year is a leap year? - Stack Overflow

    Jul 24, 2012 · def add2(n1, n2): print 'the result is:', n1 + n2 # prints but uses no *return* statement def add2_New(n1, n2): return n1 + n2 # returns the result to caller Now when I call …

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

    To access a 'def' from within a class, you need to first make an object of that class, and than do object.nameofdef(), which than executes that 'def' on the object, while if you just make a 'def' …

Refresh