约 50 个结果
在新选项卡中打开链接
  1. python - What is the purpose of the return statement? How is it ...

    What does the return statement do? How should it be used in Python? How does return differ from print? See also Often, people try to use print in a loop inside a function in order to see multiple ...

  2. function - What does return True/False actually do? (Python) - Stack ...

    2015年2月14日 · By using a return value, the function does one thing: do the calculation, and the caller can do whatever it wants with it: print it, write it to a database, use it as part of some larger …

  3. How does Python know where the end of a function is?

    How does Python know this isn't a recursive function that calls itself? When the function runs does it just keep going through the program until it finds a return?

  4. Does every Python function have to return at the end?

    2017年3月10日 · Long answer: The return statement is not required in Python, and reaching the end of the function's code without a return will make the function automatically return None Additional …

  5. What does -> mean in Python function definitions?

    2013年1月17日 · 744 It's a function annotation. In more detail, Python 2.x has docstrings, which allow you to attach a metadata string to various types of object. This is amazingly handy, so Python 3 …

  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. What does the "yield" keyword do in Python? - Stack Overflow

    2008年10月24日 · Yield in Python used to create a generator function. Generator function behaves like an iterator, which can be used in loop to retrieve items one at a time. When a generator function is …

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

    Now fire up Python 3.x and do the same thing; it says, quite plainly, that it will return an iterator. So maybe you don't see why it should do it, but I am talking about what it actually does.

  9. python - SyntaxError: 'return' outside function - Stack Overflow

    2017年2月19日 · The return function is used to pass a value back to where a certain function is called. The way I see it, you're essentially trying to overwrite the return value. You should use it in a function …

  10. Why would a function end with "return 0" instead of "return" in python?

    2012年9月30日 · Worth noting that if you omitted the return at the end of the "do_2" function the return value would still be None. You can close a function without the return just by dedenting out of the …