Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stressed that functions do not need to return a value. Issue #489. #660

Open
wants to merge 1 commit into
base: gh-pages
from

Conversation

Projects
None yet
2 participants
@IgnasiLucas
Copy link

commented Jul 2, 2019

This is meant to help issue #489.

@@ -190,6 +190,9 @@ def detect_problems(filename):
~~~
{: .language-python}

Did we forget the [return statement]({{ page.root }}/reference/#return-statement)?
We didn't. It's just that not all functions need to send a result back to the caller.

This comment has been minimized.

Copy link
@maxim-belkin

maxim-belkin Jul 19, 2019

Contributor

My suggestion:

Wait! Didn't we forget to specify what both of these functions should return? Well, we didn't. In Python, functions are not required to return a value. In cases like ours, they are used for the sole purpose of grouping together pieces of code that conceptually do one thing. In such cases, function names usually describe what they do.

some input [arguments](#argument) to some output.
: A group of instructions (i.e., lines of code) that may be executed repeatedly,
every time it is [called](#function call). Functions can accept some input
[arguments](#argument), and they can [return](#return-statement) some output.

This comment has been minimized.

Copy link
@maxim-belkin

maxim-belkin Jul 19, 2019

Contributor

How about:

A named group of instructions that is executed when function's name is used in the code. Occurrence of a function name in the code is called "function call". Functions may process input arguments and return some value(s), or may be used to group together logical pieces of code without returning any value.

I'm not super happy about "without returning any value" in my suggestion above (function will return None), but it might be OK in our case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.