Code knowledge against simplicity when looping on a list, what is the best practice?

Close Reason:

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.

Only comment:

Welcome to Code Review. Here, we review specific code and suggest how to improve it. However, the way you have framed the question, you are asking a generic question about some nebulous esthetic principle, with some code tossed in merely as an example. We don't do vague/hypothetical discussions here. – 200_success yesterday

Algorithmically the task can be similar to:

Comma Code - Ch. 4 Automate the Boring Stuff

  • I don't see how the answer to this question is likely to be any more opinion based than any other Code Review answer.
    And so I can't agree with my literal interpretation of the close reason.

  • The user has provided two solutions that work.

  • The question, to me, looks like most comparative review questions. Where the user is asking "what's the best way to do X task", just like it is here.

And so I don't see how the reasons provided justify closing the question. To me it looks like the results of a lynch mob.

Why is this question off-topic?

  • \$\begingroup\$ Primarily opinion-based doesn't necessarily have to mean off-topic. Both of them are reasons to put questions on hold. \$\endgroup\$ Jul 21, 2019 at 8:15
  • \$\begingroup\$ @SimonForsberg Ah! That, along with Vogel's answer, probably explains my confusion. Thank you. \$\endgroup\$
    – Peilonrayz Mod
    Jul 21, 2019 at 8:43
  • 2
    \$\begingroup\$ Also, from the help center: Best practices in general: It's OK to ask "Does this code follow common best practices?", but not "What is the best practice regarding X?" \$\endgroup\$
    – rolfl
    Jul 21, 2019 at 11:05
  • \$\begingroup\$ I'm not sure why you think the task being algorithmically similar to any other question is relevant. \$\endgroup\$
    – Mast Mod
    Jul 21, 2019 at 11:22
  • \$\begingroup\$ @Mast Thanks to Vogel's and Simon's replies I now know that it isn't relevant. However at the time, as I thought the question was off-topic that providing a similar question shows that at it's core it's not off-topic. Thank you for the edit. \$\endgroup\$
    – Peilonrayz Mod
    Jul 21, 2019 at 11:28
  • \$\begingroup\$ The core of the question is what makes this off-topic. The entire intent makes it off-topic. There is no request for review here. There's a request to know who's right. The code could've been reviewable, yes. But the code is hardly the core of the question here. After all, the code is not what's important to OP. He wants to know which is the best answer and which is the best practice (without defining what he means with the latter). Doesn't appear too interested in code, more in the philosophy and how to deal with things. That's not our area to deal with. \$\endgroup\$
    – Mast Mod
    Jul 21, 2019 at 11:34
  • \$\begingroup\$ @Mast Please refer to this comment where I've described what I mean by core. I think we should be in agreement, once I've clarified that. \$\endgroup\$
    – Peilonrayz Mod
    Jul 21, 2019 at 11:38
  • \$\begingroup\$ We disagree on what the core of the question is, but agree on the rest. I think. I'll write an answer. \$\endgroup\$
    – Mast Mod
    Jul 22, 2019 at 7:08
  • \$\begingroup\$ Hi, I'm the OP of the other question. My post here is not to use the "aswers" as a weapon but in order to know for futur question what to do. Since the other question solve the issue and mine too, I want to understand why his answer is better than mine, since using my point of view, his is lower. The original question in itself is borrowed, if I ask here, this is for a better understanding of good practices in code. I will not delete my answer since it works for the OP, I just want to know what is good. I heard your answers and I'm sorry if the intend behind my question is questionable. \$\endgroup\$ Jul 22, 2019 at 11:56
  • \$\begingroup\$ Since my question on code review is already long, I didn't go into details but this is an example of what I implicitly ask: Is ternary operator in a for loop is a good practice. But if it's offtopic on "code review", then thank you, you help me understand how and when to used this SE website. \$\endgroup\$ Jul 22, 2019 at 11:59

2 Answers 2


OP wants us to "adjudicate" some sort of opinion conflict they have in the comments on a Stack Overflow answer and that's not really something we do here. The only acceptable answers to the framing of the question are opinions. The code itself is not really relevant when answering.

As such this question is soliciting opinions and not reviews. Any answer is not judged on the merit of the improvements in code it presents, but the opinion it espouses. That's what makes it primarily opinion based.

  • \$\begingroup\$ Sidenote: I'm currently somewhat pressed for time, but this is the essence of a more extended answer. If need be I can expand on that a little more. :) \$\endgroup\$
    – Vogel612
    Jul 21, 2019 at 6:48
  • \$\begingroup\$ So this is more we don't want to have a flame-war on Code Review, rather than the question's core being off-topic? (If you class the questions core as just the code the user wrote and the challenge description) \$\endgroup\$
    – Peilonrayz Mod
    Jul 21, 2019 at 6:53
  • \$\begingroup\$ @Peilonrayz No. To post something on Code Review, you have to (roughly) want a review of a piece of code that you wrote or are currently using. What this user wants, is to know who is right. It's a gross misuse of the site. Had he wanted to know what's wrong with his code, he could've asked that. That may have been on-topic. But that's not what's asked here. \$\endgroup\$
    – Mast Mod
    Jul 21, 2019 at 11:18

This question has been answered already, and Vogel is absolutely right, but let's explain it further for posterity's sake. I know you know most of this already, this is for the rest of the internet.

There was a bit of misunderstanding about what is and isn't the core of a question.

On Code Review, the most important thing is that you want a review on your code. Not that you have simply have code. Having code (and it being yours and/or used in your projects, refer to the help center for the actual requirements) is a requirement, but it's not the only requirement. So it can't be the core of a question.

The code is not the core of the question.

The actual core of a question is a piece of code with the intent of it being reviewed. Often, that intent/request is implicit and that's (usually) ok. But in this case, there was an explicit request for something we don't do. And that's a problem. Just as we have a problem with feature requests on code that would otherwise probably be reviewable (but since it isn't up to spec yet, doing so would be pointless). But worse. Much worse. Here, somebody was prepping up Code Review to be a weapon in an argument.

What this question wanted, was an answer to who is right and who isn't. That's not a request for review to improve code, that's a request for an arbiter. Completely inappropriate. The code itself was largely irrelevant here.

While this question could be rephrased to a , it would likely still be off-topic then for being about general approaches. That again is something we don't do. Besides, writing an answer to it would likely be useless to the OP, so why bother? Don't try to salvage questions for the sake of salvaging them. We got plenty of unanswered on-topic questions that could use some love instead.

Note: the code in the question being algorithmically related to an on-topic question is irrelevant. Heck, it's possible to write a question containing FizzBuzz that's algorithmically related to lots of on-topic questions and still wildly off-topic.

Long story short, 200's comment is spot on and in my opinion, this specific question is unsalvageable.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .