-17

Sometimes I see questions closed as "duplicates" of a more general question. Latest example asked for finding the most common value which was closed as duplicate of finding the 10 most common values.

(Edit: The list of "dupe targets" for that question just got extended, but the general issue I ask about here remains.)

I don't think that's right. Finding the single most common value is a special case and it allows better solutions which take advantage of that. They can be simpler and they can be more efficient. Yes, the more general solutions of the more general question can be applied, but that's not optimal then.

I was told to post a special case answer under the general case question, even though it doesn't answer that question. Should I really? I think that would be wrong. And if it's indeed wrong, then is it appropriate to close special case questions as duplicates of more general questions so that answers taking advantage of the special case can't be posted anywhere?


Edit 2 because apparently nobody can imagine special case solutions possibly being better than general case solutions:

Do you think sorted(mylist)[0] is the best way to find the smallest value in mylist? Don't you think that's a bad way? Don't you think people should be taught min(mylist) for that? Do you think people trying to point out min for that should be shut up? Do you think they should instead tell min to people who asked how to find the tenth-smallest element? That's what this was like.

The "the most common value" case is just like that, with Counter(mylist).most_common(1)[0][0] vs mode(mylist). Don't you think the latter is much simpler and cleaner? It even comes with appropriate error detection/handling. And while that one isn't faster (because currently it's implemented using Counter.most_common), there are faster ones, for example max(mylist, key=Counter(mylist).get).

12
  • 7
    For the questioner, should be as easy as: "I read {duplicate question} but it doesn't apply because x, y and z"
    – brasofilo
    Dec 24, 2017 at 15:51
  • @brasofilo Well, for example in the mentioned example that wouldn't be correct, as those general solutions can be applied. They're just "unnecessarily bad". I guess they could say "I read ... but that seems like overkill", but that would require them to realize that. If someone is told "Your question is a duplicate of this other one, use the solutions there", then they might believe that that's appropriate and miss out on better solutions. And other readers of the question might be misled the same. Dec 24, 2017 at 16:02
  • 4
    You should provide a convincing argument supporting your case, as you have done in the comments here. Why do you think it is worth keeping a duplicate open just because it is not 100% identical? How many situations do you find the target does not address the question as well as a fresh answer would? In what situations is it wrong to post a new solution to an answer, just because you feel it addresses a specific case only (and not the general one?). As of now, you're only speaking in overly broad terms.
    – cs95
    Dec 24, 2017 at 16:03
  • 7
    Closing crap questions like that as duplicates is a mercy, because they should just be deleted outright. If you really want to provide an answer for the special case, then you should either wait for a better question or author your own. Also relevant: Why would a question that's normally too broad in any other language be okay in Python?
    – jscs
    Dec 24, 2017 at 16:39
  • @cᴏʟᴅsᴘᴇᴇᴅ It isn't a duplicate (of what it was originally claimed to be a duplicate of). Not sure why you think I think 100% identical is needed. I don't think that and I didn't say that or anything like it. Top 3 vs top 10, I don't see a meaningful difference. Most common list value vs most common dict value, I don't see a meaningful difference. But top 1 vs top 10 is a substantial difference and it can be exploited. Dec 24, 2017 at 16:57
  • @cᴏʟᴅsᴘᴇᴇᴅ I don't know how often this happens, didn't keep score. When is it wrong? Not sure I can answer that comprehensively, but I'd roughly say when it doesn't answer the question and isn't helpful in some other way, either. A "top 1" solution like using statistics.mode or max right away doesn't answer the "top 10" question, and it's not clear at all how it could be helpful for that. How would you use them to solve the "top 10" question? I don't see any reasonable way. Dec 24, 2017 at 16:57
  • 2
    @StefanPochmann what about top 3? Should there be a separate answer for that? Dec 24, 2017 at 17:05
  • @JoshCaswell Hmm, maybe I shouldn't have shown any example. I don't think all of them were "crap", and it looks like this example is distracting from the actual issue. About authoring my own version of the same question: Wouldn't that really be a duplicate then? Dec 24, 2017 at 17:08
  • 2
    Look, never mind, reopen it because some think the dupe is bad. I can then vtc as 'Too broad' for a no-effort homework dump. Dec 24, 2017 at 17:10
  • @MartinJames Do you mean top 3 vs top 10? Like I said: I don't see a meaningful difference between those, so I'd currently say "no". Dec 24, 2017 at 17:10
  • 2
    "Wouldn't that really be a duplicate then?" A duplicate of which? If you write a good question that explains the problem and why it's different from seemingly-similar problems, then, no. In fact, it would potentially be a duplicate master.
    – jscs
    Dec 24, 2017 at 17:16
  • Related: meta.stackoverflow.com/questions/377171/…
    – user202729
    Mar 1, 2021 at 0:25

1 Answer 1

9

Special case questions should be closed as duplicate of more generic variant of the same question unless there is a clear indication that OP knows of general solutions and provided clear explanation why general solution does not work for that particular case or how it should be improved (explanation can be edited in later to trigger re-open).

If more generic question does not cover standard solutions for special cases: either make question even more general and add answer for special cases or create a new canonical question that covers all cases (make sure to close/organize closing other ones as duplicates of new canonical).

As for "common 1" vs. "common 10" sample in this question: every (all of one) answer to "common 10" question should also answers "common 1" question. So duplicate is valid assuming OP needs "a method" of getting the answer. It may be good idea to make "common 10" question even more generic and include answer for "common 1". Additionally this particular question asked many times in all sorts of languages (https://www.bing.com/search?q=most+common+elements+in+array) - so the only new variant that may be acceptable is debugging question in form: "I tried link and here is my MCVE which produces unexpected result ..., I believe it is because ... but ... did not solve the issue".

9
  • What does it matter what the OP knows? Are questions and answers solely for OPs? I thought they're supposed to be for the benefit of everyone. Same with your other argument. Just because a bad method might satisfy the OP, doesn't make the bad method good and doesn't make better methods not valuable. Dec 24, 2017 at 19:34
  • 5
    I agree completely with this answer. It is incumbent upon OP to try to solve their problem using the general methods first, otherwise we go back to being a free job-outsourcing service (remember “I checked NSURLConnection but I could not integrate that code” from whathaveyoutried.com? That’s the epitome of this mindset). If OP tried the general methods and they didn’t work, let them describe those efforts and the challenges still remaining. If OP wants to know if there’s a specialized solution which is more effective for their case, let them ask that question.
    – Dan Bron
    Dec 24, 2017 at 19:55
  • 2
    @StefanPochmann In my experience, the more general an answer that works can be, the better, in terms of being for the benefit of everyone, the answer is. If the answer just applies to one specific case under certain circumstances, but a more general solution solves the same issue and 10 other potentially specific issues, then the general solution should be more available to the general public. And I don't see where anywhere in this question or answer it's been suggested that the general method is at all a bad method, so I don't understand where your second point comes from.
    – Davy M
    Dec 24, 2017 at 20:25
  • @StefanPochmann indeed questions and answers are for everyone, but someone needs to make an effort to clarify why generic answer does not work - so who do you suggest need to add clarifications to the question? If that would be someone else than such edit likely to be considered too significant and likely reverted... Dec 24, 2017 at 21:04
  • @DavyM You think sorted(mylist)[0] is the best way to find the smallest value? You don't think that's a bad way? You think people should be taught that instead of min(mylist)? And people trying to point out min should be shut up? The "most common value" is just like that, with Counter(mylist).most_common(1)[0][0] vs mode(mylist) (or some other advantageous special case solutions now hidden in the comments of the now deleted question...) Dec 24, 2017 at 21:47
  • @AlexeiLevenkov No. Nobody needs to clarify why the generic answer doesn't work. Especially if it does work, which it usually does, being generic. Also, please see my reply to brasofilo. Dec 24, 2017 at 22:13
  • 3
    @StefanPochmann I wouldn't consider sorted(myList)[0] to be more general than min(myList), so I'd be surprised if someone tried to claim that was a generic solution duplicate in the first place. I also don't see anyone being told to "shut up" as you say, rather, this answer is asking a questioner to actually say more and show why the generic solution isn't what they need/want.
    – Davy M
    Dec 24, 2017 at 22:25
  • @DavyM Well sorted(myList)[i] of course. For the more general question of finding the i-th smallest value. And "shut up" refers to closing the question, making it impossible to post an answer. Dec 24, 2017 at 23:15
  • @StefanPochmann I've added "make more canonical" part to my answer. I don't see need creating separate unrelated posts for special cases (obviously it is my opinion and you can, also not really welcome, create individual questions for all combinations like "select first item", "select second item", "select first and second item"... - there are such examples in C# LINQ questions bing.com/search?q=c%23+linq+second+element) Dec 26, 2017 at 2:17

You must log in to answer this question.

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