About 5,380,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. 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 …

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

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

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

  7. What is the purpose of the `self` parameter? Why is it needed?

    def fubar(x): self.x = x class C: frob = fubar Now the fubar function wouldn't work since it would assume that self is a global variable (and in frob as well). The alternative would be to execute …

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

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

  10. How can I return two values from a function in Python?

    def newFn(): #your function result = [] #defining blank list which is to be return r1 = 'return1' #first value r2 = 'return2' #second value result.append(r1) #adding first value in list result.append(r2) …