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

Add guideline for ignored values #17

Merged
merged 4 commits into from
Nov 29, 2017
Merged

Add guideline for ignored values #17

merged 4 commits into from
Nov 29, 2017

Conversation

vladimir-v-diaz
Copy link
Contributor

No description provided.


```Python
for _ in range(10):
do_something()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you say that i is permissible for an unused iterator? This example might imply to people that it's not.

Copy link
Contributor

@awwad awwad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for pylint rules, I guess? Seems like a sensible recommendation, though I think I might add a few words on why. Something like "In order to make clear to the reader that a variable is not used...", or even just "for readability".

@vladimir-v-diaz
Copy link
Contributor Author

Would you say that i is permissible for an unused iterator?

By convention, i, j, k, and _, are often used in this case. Although Pylint follows the i, j, k, _ convention, Justin recommended we use junk in instances where a returned value is unused.

In the guideline, I say: "The variable name junk should be used in cases where a returned valued must be stored but the variable itself is unneeded." Is this not clear enough? Should I justify why we recommend junk over the i, j, k, _ convention?

@awwad
Copy link
Contributor

awwad commented Nov 27, 2017

I think an explanation would probably be good for why this guideline exists, yes.

I think that using "junk" where a returned value is unused makes sense, yes (example 2). I'm not sure I agree on the iterators (example 1), though.

@vladimir-v-diaz
Copy link
Contributor Author

@JustinCappos Are you okay with allowing i, j, or k for iterators?

@JustinCappos
Copy link
Contributor

JustinCappos commented Nov 28, 2017 via email

@vladimir-v-diaz
Copy link
Contributor Author

Okay, I added more examples and an explanation. Let me know if anything else is needed.

@awwad
Copy link
Contributor

awwad commented Nov 29, 2017

👍 LGTM

@vladimir-v-diaz vladimir-v-diaz merged commit ca85c23 into master Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants