I stumbled upon the following question in the reopen queue:

Checking if a number is a prime number in Python

The question the user wants answered boils down to a trivial error in a while-loop (in a code for finding prime numbers), which is a bit trivial. (Or even very trivial. I'm not arguing that the question is a good fit for us.)

The top answers discuss how to solve the underlying problem (finding prime numbers) - which as the duplicate-tag says can be found in How to create the most compact mapping n → isprime(n) up to a limit N?

I decided to keep it closed, but I realize that part of my decision was based on the answers being duplicates - and not on the question itself. That lead me to the general question: should the answers be considered in these kinds of situations?

Note: That some view it as a duplicate of Does the same answer imply that the questions should be closed as duplicate? However, it seems that the close-instructions have changed last year, and says "This question already has answers here:" going in a different direction - I don't know how that best is handled.

  • 11
    Personally, I suggest not. If I know a question is a duplicate, I close it. I know there are some users that are yet to find the "Close as Duplicate" feature, even after they have accrued plenty of reputation and Gold Badges. Also, if a question gets plenty of answers (3 / 4+) in a matter of minutes it's also a strong indicator there's a duplicate out there. – Larnu Jun 8 at 15:51
  • 1
    @KevinB There is at least one answer for the actual question, but far from the top. – Hans Olsson Jun 8 at 15:52
  • 3
    In other words, IMO it's better as a sign post, than a unique question. People who find it aren't looking for a solution to the actual problem the op had. – Kevin B Jun 8 at 15:53
  • 25
    A question being closed doesn't make it a bad question; people seem to think the 2 are synonyms. Often it is the case, but for duplicates this isn't true. There are plenty of questions closed as duplicates that are great "sign posts". By this we mean it's a different way of asking the same question; thus someone with either question (the original or the dupe's) would be directed to the existing answer. – Larnu Jun 8 at 15:55
  • 9
    Yes, you should, the close banner says: "This question already has answers here:" not "This question has been asked before here:" – Nick Jun 8 at 15:59
  • 2
    Honestly, I don't see the duplicate answering the question. It's a hodgepodge of advice, links, musings, and code in various languages. – MisterMiyagi Jun 8 at 18:07
  • 4
    To me the critical determining factor is: will the poster agree that the "duplicate" answer solves their problem? – Michael Kay Jun 8 at 18:16
  • 1
    @KevinB Oh, don't get me wrong – I would love hammering all those Ys out there with Xs. But something tells me that would not actually be appreciated at large... – MisterMiyagi Jun 8 at 18:19
  • 2
    Or as an alternative to deleted there should be a way to have temporary debugging questions separately; so that they just disappear after awhile or aren't searchable. But that's a different topic – Hans Olsson Jun 8 at 18:24
  • 4
    What a shambles! :( The OP's goal is to test for prime numbers, but their problem is 1) they're looping over a tuple instead of a range, and 2) inside that for loop they're getting trapped in an infinite while loop when a is prime. A decent answer needs to address those two points. Once that's taken care of, the answer could mention improvements to the the primality test (eg, only testing divisors <= sqrt(a), and only testing odd divisors after checking that a is odd). Simply dupe-hammering it to a language-agnostic question about primality testing is not appropriate. – PM 2Ring Jun 8 at 19:59
  • 1
    @PM2Ring: "dupe-hammering it to a language-agnostic question about primality testing is not appropriate" -- if the question had been posted yesterday, your point would be valid. But it wasn't. The question was posted a decade ago, the author disappeared without accepting the actual answer, and then some years later, people started coming across the question based on the title, paid no attention to the question itself, and posted answers that were answers to an entirely different question, one that already had answers on the site, i.e. the duplicate target. At this point, people are ... – Peter Duniho Jun 9 at 4:59
  • 1
    ... primarily (no pun intended) finding this question because they are looking for the duplicate. I think it's safe to say that no one is finding this question because they inserted an infinite while loop in their prime-checking code, so the question does a much better job serving as a signpost than it does as a place to find an answer to the question the author was actually asking. IMHO, if the question isn't closed as a duplicate, it needs to be deleted altogether, with the inappropriate answers moved to the duplicate target. – Peter Duniho Jun 9 at 5:00
  • 2
    @Peter Yes, I was talking about what ought to have been done when the question was fresh. I wasn't suggesting we need to do that now. I think deleting it is probably the best course of action. And I don't think we need to preserve the answers written by people who didn't read the question properly. We have plenty of questions on primality testing in Python, the loss of one signpost is no big deal. – PM 2Ring Jun 9 at 7:09
  • 2
    Then it wasn't a good signpost, @MarkRansom . A good signpost gets upvoted, and thus won't be deleted. – Larnu Jun 9 at 15:06
  • 2
    A question closed as a duplicate can still be reviewed and gain updates, @MarkRansom . Also, a user that votes to close can still upvote a question is it's well presented and researched. The fact, however, is that the majority of questions that are duplicates are because the OP didn't perform any research (or certainly didn't demonstrate it) and sometimes just searching their title gives the dupe candidate; in those scenarios downvotes are often made. Just because most duplicates are deleted (due to a lack of upvotes) doesn't mean they all are. – Larnu Jun 9 at 15:13

Sometimes, but not always.

Folks can come up with all kinds of trivial examples where two questions have the same answer but are not duplicates. Most of these are exceedingly trivial, involving mathematics or something like, "What color is a tree frog?" and "What color results when you mix blue and yellow in a subtractive pigment-based color system?" I think most of these so-called examples are stupid. In the real world of Stack Overflow, there are plenty of cases where two questions having exactly the same answer makes them duplicates. Then, of course, there are cases where it doesn't. So…and here comes the rub—you have to work this out on a case-by-case basis by using your brain.

"Is this question fundamentally asking the same thing as that other question?"

If the answer is "yes, I think so", then vote to close it as a duplicate. If the answer is "no, but the answer could be used to…", then it's not a duplicate. Post an answer explaining the answer and including the link to the other Q&A as supplemental. (There is no need to repeat everything from the other Q&A. Your answer just needs to connect the dots between the two questions.)

An example that I actually like to use is when there are two questions about the same API, both experiencing the same failure point in using the API, but the questions are written in the context of two different languages. Are these duplicates? Yes. The language is not germane to the actual problem: the problem is a misuse of the API, and the correct usage of the API is the same, regardless of which language is being used. So, these should be marked as duplicates to connect them. The answers to one question solve the other question, too. (Yes, I realize that this requires the people who make the assessment of whether a question is a duplicate to actually read the question and have some domain-relevant knowledge. I consider that to be a feature, not a bug. If you don't know or don't feel comfortable making a call, hit "Skip".)

The flip side of that coin is when there are two questions about the same API, written in two different languages, but where the API is not relevant to the failure mode. If it's a language problem, then it's not a duplicate of some other question that happens to be using the same API or the same construct. Why? Because the answers are not the same.

Another common failure point when assessing duplicates is failing to read beyond the question's title. This particular case is an excellent example. If you just read the title: "Checking if a number is a prime number in Python", then, yes, I would agree that is a duplicate of How to create the most compact mapping n → isprime(n) up to a limit N?. But, part of the "using your brain" advice given above is to use it to read the entire question before reaching a final decision. (This is very important because (A) writing a good title is hard, and (B) askers often focus on the wrong parts of their problem because they don't know what the real problem is which is why they're asking a question in the first place.) Reading the actual question, it becomes very clear that the person is neither asking about nor having a problem with a primality test. Their problem is much more fundamental, and it involves basic language constructs. That would argue strongly for it not being a duplicate.

Unfortunately, the real world strikes again, further complicating matters. All of the answers to that question chose to answer the titular question, rather than the body question. All of the answers essentially say, "Forget what you're doing and use this primality test instead, because it's better and it works." Which is a fine strategy for answering, except that they don't actually say the "forget what you're doing part" or the "instead" part. At any rate, considering the age of the question and these existing answers, I think that again puts it back into "duplicate" territory. In particular, I don't see what positive good would be accomplished by reopening that question at this point. Its fate would likely be to have it closed as a typo, which would argue for its deletion, thus losing the answers there that might be providing valuable insights. All things considered, I'd rather leave it as a duplicate.

But were the situation different on a new question, I'd likely argue for handling it differently. Namely, by reading, evaluating, and answering the actual question that is asked in the body of the post.

  • 3
    TL;dr: read the darn question and forget about the answers. – Braiam Jun 9 at 1:02
  • 2
    I don't think 'All of the answers essentially say, "Forget what you're doing and use this primality test instead, because it's better and it works."'. This Answer seems to address the Question :) – Scratte Jun 9 at 7:25
  • 1
    "Their problem is much more fundamental, and it involves basic language constructs. That would argue strongly for it not being a duplicate." Well, at least in the PHP tag where I hang out, there are a LOT of questions about basic language constructs, and they most certainly are duplicates. In a perfect world we wouldn't need a canonical question on how to concatenate strings, but... – miken32 Jun 9 at 15:22
  • 3
    Sorry, @miken32; my word choice may have been poor there. I don't mean to say that questions about basic language constructs cannot be duplicates. They most certainly can, and, I agree, generally are. What I mean is that, since it is a question about basic language constructs, it cannot be and is not a duplicate of that specific proposed question about how to generate random numbers. I also disagree that in a perfect world we wouldn't need a canonical about concatenating strings. No question is "too basic" for SO; it deserves a good answer. All that sucks is getting the same Q repeatedly. – Cody Gray Mod Jun 10 at 5:42
  • Sometimes the "apparently duplicate" question may getting more up-to-date answers than the accepted answer in the original question. In such case that question is to be considered fundamentally different right? Because the OP may have had to ask the question because the original question's accepted answer is no longer valid. – rineez Jun 11 at 6:42

There should be no general rule of thumb for this one other than you need to look at each given scenario as unique.

This specific question should have been edited 10 years ago to be clearly about the OP's problem rather than asking how to do X, but it's way too late to correct that mistake. Instead, we need to deal with this question in the way that will best serve the community. It has useful answers, but they're almost all answers to a different question.

I wouldn't be against merging in this case, but merging or not, reopening seems counter-productive.

  • Ah! I didn't know there is also an option to Merge. – rineez Jun 11 at 6:43

What's the problem with "this kind of situation"?

As noted already in this answer, this particular question you're asking about is a really unfortunate example. The author posted it and then abandoned it. As a result, while it got a very good answer to the question that was asked, it attracted the attention of other people who posted answers to this question-without-an-accepted-answer that were inappropriate for the question itself, but which found an audience in the people who sought out the question based on the title of the question.

For better or worse, this question now is a duplicate of the other one. The question really should have been closed as "typographical error". It's unlikely that the literal question is ever going to be similar enough to the mistake someone else makes that it and the correct answer to it would be useful to any future reader. But the questions to the incorrectly-interpreted question could be useful (though they really belong elsewhere), and closing this question as a duplicate can direct people to the better Q&A.

About your exact question:

should the answers be considered in these kinds of situations?

You might need to be clearer about what "these kinds of situations" actually means to you. That said, I'd say that in general, answers can and should be taken into account.

If by "these kinds of situations" you mean the situation as it stands today, then I would say yes, the posted answers should be taken into account. People are clearly using this question as a signpost for the more general question of checking for primality using Python, and the question should be closed so as to a) show people the way to the question with many more answers and which addresses the general question much more thoroughly, and b) to encourage anyone who thinks that after all this they still have something to contribute to post their contribution on the question that serves as a more appropriate canonical post, rather than this one.

If by "these kinds of situations" you mean the situation as it stood before the broader answers were posted, then even then valid answers to the question provide insight into what sort of existing questions might be suitable duplicate targets. I.e. if it happened that someone posted an answer that was essentially the same as one found elsewhere, and the author of the question accepted that answer, then the author of the question is telling you that the other question is in fact essentially a duplicate of their own question.

There are other kinds of "these kinds of situations" we might consider, such as questions with typographical errors, or questions where the author has abandoned the question, etc. But however one slices it, this particular example seems to have an unusual (perhaps unique) characteristic that would defeat an attempt to generalize further. I think at best, we mainly can talk about this question exactly, and cannot very well extend the conclusion to other questions, unless they somehow manage to have the exact same problems (which seems unlikely, though I admit I can't rule it out).

What do we do now?

Frankly, I think at this point, what ought to happen is that this question should be closed as a duplicate of the other, to let it serve as a signpost without allowing further contributions to it. There are as many useless answers to the question as there are useful ones, and it's clearly attracted undesirable attention in the form of answers that aren't going to help the author of this original question (that person is long gone), nor are going to help people who stumble across the question due to the title instead of the content.

Closing it would shut the question down (if we can get the community to agree and not get into a close/open war), preventing more useless answers while still directing people to where they really want to be.

Alternatively, the question could be closed and deleted. That's what should have happened when it was first posted, but it somehow slipped under the community moderation radar. It was never a useful question, being specific to the exact typographical error in the code, and the author of the question didn't even bother to accept the one answer that actually did address the question they actually asked.

If this is how the question is disposed, the three answers posted that are really answers to the duplicate target, should be moved over to that question, so that they aren't lost when this question of concern is deleted.

IMHO the first option is preferable, given that the title of the otherwise-legitimate duplicate target doesn't say nearly as clearly what the question is about as this question says what its duplicate target is about (even as it fails to accurately describe the problem that this question is actually asking about). This makes it a very good candidate as a sign-post.

But I wouldn't shed any tears if the second option was taken. It seems like an almost equally valid approach.


I don't know what's really going in SO. I usually see post closed based on duplicate or answer exists already. Usually when OP posts something it may be different scenarios or context.

Some are getting closed and some are getting deleted it feels so bad after spending some time on the solution.

So my question what's wrong if there is duplicate answer ? Reader will get multiple solution let him apply whatever fits close to his/her problem.

There is no point in deleting answer if it was duplicate. I beleive SO is not out of space/storage where in older days every piece of storage was expensive.

Probably fights like close/reopen also will end in SO.

  • 3
    The point is to not turn this site into a forum where everyone says the exact same thing and they're all scattered about web searches. – Makoto Jun 17 at 17:03
  • 3
    Don't you think with multiple titles on sitemap, search possibilities will be closer.. as not all search on web in same pattern. Ex: I may search by error, you may search by keyword, some other search by some function etc – Akshay Hegde Jun 17 at 17:17
  • 4
    ...which is why questions closed as a dupe isn't that much of a sin; you can still find those kinds of answers if and only if the questions are closed and they point to the relevant related question. Question closure is not the end of the world, and we really should stop regarding it as such. – Makoto Jun 17 at 17:21
  • Suboptimal answers to duplicate questions are the greater problem, they waste everyone's time and don't add any value to the subject they (fail to) contribute to. If you post really good answers to duplicate questions, you don't have much to worry about; they will be migrated to the duplicate target in the worst case, or left alone. – oguz ismail Jun 17 at 18:00
  • 3
    But who will decide which is duplicate, I see many posts on SO blindly flagged as duplicate just based on "keywords". where it's contributing to knowledge base nowhere. Just because of group of 3 people or one person with some badge it's been decided. Some use this tool properly, and some misuse it for personal revenge. – Akshay Hegde Jun 17 at 18:16
  • 3
    If you have evidence a closure is misused for personal revenge, I highly encourage you to flag for moderator attention and state your evidence. They can look into it an reopen the question if needed. Also, while it only takes 3 people to close, it only takes 3 people to reopen – Heretic Monkey Jun 17 at 19:05

No, you should not. We are closing questions, not answers. If one question has no answers, does that make the question not a duplicate? Of course not.

The only moment you should consider answers is when you are deciding the target. Or if both questions have different good answers, but they are the same question, ask for a merge instead.

  • 1
    I agree with this definition of "duplicate". Unfortunately, the close banner mentions "there are answers here ...", maybe to appear less aggressive. Also, the system itself doesn't allow targets that are unanswered, or don't have upvoted answers. – cigien Jun 8 at 20:55
  • @cigien that's because you can't close duplicates to a question without answers, something that was well intentioned at first, but now we are dealing with the consequences. – Braiam Jun 9 at 0:54

You must log in to answer this question.

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