-
Notifications
You must be signed in to change notification settings - Fork 264
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
Assignments/function calls in a return statement? #47
Comments
I found another example that I wrote for our internal team guidelines: Do not create values for a function parameter as part of the call to that function. This makes debugging and testing really difficult. For example, instead of:
rather:
|
This is an interesting suggestion, thank you @gamesbook! I personally tend to follow your style (of setting a label for a complex calculation before issuing a Labeling this "research needed" for now. |
Probably a personal preference, but I like to have values already set or calculated before the return is called. This example from Django, as part of a typical views module:
The
context
can contain many variables, and I think its easier for readability and debugging purposes to create/set all of its values before the return is called; it is an extra variable but I find the trade-off is worth it.The text was updated successfully, but these errors were encountered: