About 8,790,000 results
Open links in new tab
  1. 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 turns out this is …

  2. What is a DEF function for Python - Stack Overflow

    Sep 10, 2013 · 14 def isn't a function, it defines a function, and is one of the basic keywords in Python. For example:

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

    Jul 8, 2017 · We could use any other legal Python name, but you will likely get tarred and feathered by other Python programmers if you change it to something else. __init__ is a special method, …

  4. Is it possible to not return anything from a function in python? (What ...

    A new Python checker was added to warn about inconsistent-return-statements. A function or a method has inconsistent return statements if it returns both explicit and implicit values ...

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

    Values aren't returned "in variables"; that's not how Python works. A function returns values (objects). A variable is just a name for a value in a given context. When you call a function and assign the return …

  6. python - How do I get ("return") a result (output) from a function? How ...

    Suppose I have a function like: def foo(): x = 'hello world' How do I get the function to return x, in such a way that I can use it as the input for another function or use the variable within...

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

    For a language-agnostic consideration of the design decision, see What is the advantage of having this/self pointer mandatory explicit?. To close debugging questions where OP omitted a self …

  8. python - How do I define a function with optional arguments? - Stack ...

    466 I have a Python function which takes several arguments. Some of these arguments could be omitted in some scenarios.

  9. Why do we use __init__ in Python classes? - Stack Overflow

    Classes in Python make up of collections of different data, that behave similarly. Class of dogs consists of Fido and Spot and 199999999998 other animals similar to them, all of them peeing on lampposts. …

  10. python - Why use def main ()? - Stack Overflow

    Oct 28, 2010 · It will be possible to import that python code as a module without nasty side-effects. This means it will be possible to run tests against that code. This means we can import that code into an …