44

I have been growing increasingly annoyed by the lack of good canonicals and the number of bad questions that are commonly used as duplicate targets. (Sometimes because there's no better alternative, and sometimes because the question doesn't look bad at first glance.) Some of these questions are merely slightly worse than they could be, while others are actually horrible or even straight up incorrect.

Let's look at an example. (A python example, because that's my most-used language.)

  • The question: How do I replace every x character in a string with an y?

    Obviously, this is a trivial question. I'm looking for an answer along the lines of input_string.replace('x', 'y').

    Among the top google results are these candidates:

    1. This one is performing the substitution on a list of strings, so all the answers focus more on explaining list comprehensions or the map function than on the replace method.
    2. This one contains way too much fluff (reading a csv file) and the OP was actually already aware of the replace function; they just forgot to assign its output back to the variable. It's basically a typo.
    3. This one is unclear (the OP is trying to replace only those x characters that appear at certain indices, but that's not obvious at a glance) - and the accepted answer doesn't even answer that question! Most of the 17(!) linked questions are incorrectly marked as duplicates of this unclear mess!

    And that's it. There aren't really any other alternatives. From the first google results, this one is about migrating from python 2 to python 3, this one is asking how to do multiple substitutions, and this one is asking how to replace a single character at a certain index. There isn't a single good duplicate for a trivial string substitution question!

I'm not sure what to do in this situation.

  • Should I post a self-answered Q&A about this trivial topic? It would probably be downvoted and closed as a duplicate.
  • Should I wait for someone else to ask this question and then post an answer there? If so, how would I prevent other members of the community from closing the question as a duplicate?
  • Should I edit one of the existing questions into shape? I could remove some unnecessary code from this question, but I'd also have to edit the 3 answers to match and there's no way to know if all 4 users (the asker and the 3 answerers) would accept that.
  • Should I try to salvage (i.e. edit and reopen) one of the questions that were marked as duplicates of one of these? I had a short look around and it seems to be fairly difficult to find a decent question among them. I would also have to edit the existing answers to match the edited question, so this is probably more trouble than it's worth.

Please keep in mind that this is just an example. Quite a few people have suggested to leave a link to the documentation in the comments; that is an option if the question is as trivial as this, but there are also more complicated questions than this that also suffer from a lack of good canonicals.

Bonus question: What can I do to make people stop using an unclear/misleading question like this as a duplicate target?

24
  • So you simply want to create a Q&A for a trivial function within python? [considering your example of course] Commented May 19, 2018 at 20:05
  • 11
    @TemaniAfif Well I don't want to. I don't enjoy writing trivial questions with trivial answers, all the while trying to convince the SO community not to close my trivial question as a duplicate. But it's an option, and I'll do it if there's no better solution.
    – Aran-Fey
    Commented May 19, 2018 at 20:15
  • Why not just point people to the documentation? Assuming that Python has good documentation of course. A quick search on Google yielded this question, which talks about how to replace strings in Python 3. Also Change one character in a string?. And Replacing a substring of a string with Python. But I don't know Python well enough to know if those are good canonicals or not. Commented May 19, 2018 at 20:19
  • Maybe the question is: what is a duplicate question for you? (the never-ending debate). I myself close regulary questions as duplicate for some unlcear question like you said simply because the issue is the same and the answer will be the same .. so within this unclear question there is the good and trivial answer, thus I close as duplicate to avoid having duplicate answers ... Another point is that people need to understand that SO is not a tutorial website, we can ask how to do things but not for trivial ones that we can easily find by reading the documentation and using built-in functions Commented May 19, 2018 at 20:19
  • 6
    Excellent question. In particular, it gets awkward when there is an obvious dupe target candidate, but the answer in it you really want to direct people to is the sixth one, coming after five other imprecise or subtly misleading ones.
    – duplode
    Commented May 19, 2018 at 20:21
  • @duplode I totatly agree with you and in such case I close as dupe and I add a comment to say "Don't stick to the accpeted one, read ALL the answers" Commented May 19, 2018 at 20:23
  • 6
    I'm not a big believer in the notion that a canonical fur such trivial problems should exist at SO. That would be awful. And just post a comment to the doc page. Commented May 19, 2018 at 23:43
  • 1
    I will leave this for someone else to officially answer, but what you can do is ping/flag a moderator (preferably one who has a high score in the parent language you are working with), asking them to consider merging the Q&A sets with a new canonical by you, assuming that the answers to the existing questions are broad enough that they would fit your new canonical. But if a decent set already exists, it's probably best to just edit the best question into shape, make it more canonical-sounding (without invalidating existing answers), and then flag other Q&A sets as dupes of it.
    – TylerH
    Commented May 20, 2018 at 0:55
  • 3
    @MikeMcCaughan Because we cannot "vote to close as duplicate of manual", of course.
    – user202729
    Commented May 20, 2018 at 2:34
  • 3
    @HansPassant I also think they should not exist at Stack Overflow, but "leaving a comment" won't just solve the problem. Instead ||| (1) someone ask trivial question. (2) someone else leave a comment but cannot close because there are no suitable close reason. (3) someone else answers the question, providing OP with full code. (4) (optional) OP accept the answer. (5) Repeat. ==> In the end, SO contains full of low-quality questions that are not closed.
    – user202729
    Commented May 20, 2018 at 2:48
  • 2
    Just stop focusing on trying to close the question, it is unlikely to happen without good close reasons available. The comment is good enough to discourage answers, roomba takes care of deleting the question. Commented May 20, 2018 at 7:26
  • 4
    @HansPassant No amount of comments is enough to prevent people from posting answers. Realistically, if the question isn't closed, there'll be 3 near-identical answers plus one or two terrible ones. And even if that wasn't the case - what do I do if the question isn't so trivial that it can be solved with a link to the documentation?
    – Aran-Fey
    Commented May 20, 2018 at 7:35
  • 1
    Meh, that is not my personal experience, a duh! comment works pretty well. At least in the tags that I visit, [python] is a bit different. You otherwise seem to sputter about the kind of Q+A where a decent answer would be useful and expected. Cheer up, it isn't all black-and-white and hopeless. You've reached the stage where you don't even look at questions like that anymore. Well, shouldn't. Commented May 20, 2018 at 7:42
  • 1
    @MikeMcCaughan (1) Downvoting and closevoting are not hostile. (2) They will still be asked, whatever we do, just by different persons. We can never make people read.
    – user202729
    Commented May 20, 2018 at 16:11
  • 1
    @gnat I really like the answers by Gilles and Benjamin Gruenbaum there. One possible complication is that, for some reason, the community at large seems to have become less receptive to this kind of contribution. (Cf. the comments I exchanged with coldspeed under their answer here.)
    – duplode
    Commented May 21, 2018 at 12:04

3 Answers 3

6

I'm going to dissect each one of these options first, and then we can decide the best course of action.

Should I post a self-answered Q&A about this trivial topic? It would probably be downvoted and closed as a duplicate.

Don't even bother. There is nothing you can do to convince users who happen across your question that you are posting this for the sake of the community instead of earning points.

If you really wanted to post a successful canonical, you would have to answer the following questions:

  1. How to replace a certain character
  2. How to replace (more than one) specific characters
  3. How to replace a specific substring
  4. How to replace multiple substrings
  5. How to replace characters at certain indices
  6. How to replace strings matching XYZ pattern (regex)

Now extend 1—6 to work with strings in a list. Now extend 1—6 to work with other libraries (like pandas).

Now this post is way too broad to serve as a good canonical.

Should I wait for someone else to ask this question and then post an answer there? If so, how would I prevent other members of the community from closing the question as a duplicate?

This is what happens anyway. A basic RTFM question is asked, happily answered and upvoted by 5 people. You can look for [python] "str.replace" in search for examples.

Should I edit one of the existing questions into shape? I could remove some unnecessary code from this question, but I'd also have to edit the 3 answers to match and there's no way to know if all 4 users (the asker and the 3 answerers) would accept that.

This seems like the best option by far. We recently did this for another question. The OP was not actually asking how to delete an item from a dictionary; they already knew how to do that. Their question was on non-destructive deletion... however over the years, that question's meaning has been lost as it has served as a duplicate for so many questions that actually deal with deleting an element. Now that the damage is done, the best thing to do would be damage control.

However... where do you stop? If you wanted one good canonical, you would need to have the question cater to the 6 points I mentioned earlier. Otherwise, find 6 different questions that address each point and use each one where appropriate.

Should I try to salvage (i.e. edit and reopen) one of the questions that were marked as duplicates of one of these? I had a short look around and it seems to be fairly difficult to find a decent question among them. I would also have to edit the existing answers to match the edited question, so this is probably more trouble than it's worth.

(My previous point for this was not well thought out because I had to catch a flight and was in a rush. I've rethought it and here's my next point, lifted from my comment below.)

It would be better to edit an old question (as discussed above) than reopen a closed question and edit it. For one, you'll end up doing the same work to get the questions into shape either way, and two, the older question has a lot more visibility on Google search (having been around longer) and is therefore easily searchable for people with this problem. This should hopefully reduce the chance of more questions like this popping up in future.

12
  • Editing one of the more popular questions is probably a good idea just because it's popular. Popularity and discoverability are important for a good canonical. But it's problematic if none of the popular questions are a good fit. For example, I could reduce the code in this question, but it would still be a suboptimal dupe target in my opinion (because that OP already knew about str.replace and just made a simple error). It wouldn't be a good question to teach people about str.replace.
    – Aran-Fey
    Commented May 20, 2018 at 19:28
  • 1
    Maybe I'm asking too much, but I would very much prefer to have a duplicate that's actually good, and not just more-or-less related. Imagine if you're a newb who doesn't know str.replace and you're directed to a question that asks "Why doesn't str.replace work in my code?". That would be horrible. Shouldn't we try to provide a really good Q&A instead of just doing damage control?
    – Aran-Fey
    Commented May 20, 2018 at 19:28
  • 2
    Also, I don't agree with your statement about salvaging one of the closed questions: "If you did this for one, you should do this for every one". Why would I have to salvage all of them? I just need one to turn into a canonical. The others can keep rotting for all I care.
    – Aran-Fey
    Commented May 20, 2018 at 19:32
  • (1) "Don't even bother. There is nothing you can do to convince users who happen across your question that you are posting this for the sake of the community instead of earning points." -- I'm not disputing your diagnosis, but...it shouldn't be like this. (2) I'm inclined to agree with @Aran-Fey on "Shouldn't we try to provide a really good Q&A instead of just doing damage control?" -- supplanting a clumsy duplicate target with a better one looks like an improvement, even if the replacement cannot possibly become a bulletproof canonical in the way you suggest.
    – duplode
    Commented May 21, 2018 at 3:31
  • @Aran-Fey, that is the case with every misunderstood dupe target, and solving it is not simple. However, the question does ask about a common misconception of str.replace (whether it is in-place or not), so you could consider tidying it up a bit along with the top voted answers to remove the fluff.
    – cs95
    Commented May 21, 2018 at 5:24
  • @Aran-Fey Yes, but a newbie who doesn't know what the function does has no business using the function at all. They should've done all their reading up on the documentation before writing code. When you learn to run before learning to walk and then ask me why you keep tripping, there's not much I can do but ask you do go back and start from the beginning.
    – cs95
    Commented May 21, 2018 at 5:26
  • @duplode The assessment may be harsh, but is accurate. The community holds self answered questions to a much higher standard than normal posts. You may have seen this on meta, it is a good example. As for (2), you may see my reply to Aran-Fey in the comment above.
    – cs95
    Commented May 21, 2018 at 5:29
  • @Aran-Fey In response to your point about salvaging closed questions; consider this: it would be better to edit an old question than a closed question because you're doing the same work either way; and the former has a lot more visibility on google search, so the chances of more duplicates arising is a lot lesser. My previous point was not well thought out as I was in a hurry to respond to your post.
    – cs95
    Commented May 21, 2018 at 5:31
  • (1) That Meta thread feels off-kilter. There seems to be a fair amount of fishing for reasons to close, and one of the answers explicitly says "it was self-answered at the time, on a very popular tag like C [...] Those 2 reasons made me think that OP was posting the Q&A only to get reputation points". There is some irony in you getting accused of not assuming good faith there. (2) On "no business using the function at all", some questions might indeed be too trivial to justify recreating them. The underlying question being worth having here, though, might tilt the balance.
    – duplode
    Commented May 21, 2018 at 11:44
  • 5
    "There is nothing you can do to convince users who happen across your question that you are posting this for the sake of the community instead of earning points." Community wiki?
    – canon
    Commented May 21, 2018 at 16:23
  • 1
    @canon Never even occurred to me, but yes! Great idea! I still maintain that it would have to be more than "oh, here's this obviously named function that does exactly what the docs say it does"... to be useful and applicable enough as a canonical.
    – cs95
    Commented May 21, 2018 at 16:42
  • "Now this post is way too broad to serve as a good canonical." Related: meta.stackoverflow.com/questions/418516 Commented Jul 1, 2022 at 21:39
4

In the general case the steps to take to solve this issue will depend on how popular the de facto canonical is and how many questions point to it. Very popular posts tend to have a lot of inertia and posting a new answer could be fruitless in short and medium term.

If the issue is about a very popular post, take it to Meta. Most of these need to be solved on a case-by-case basis. Otherwise,

Try to reuse existing content

  1. Get the agreement of authors via comments, explain your approach;
  2. Edit existing questions and/or answers;
  3. Start pointing new (and optionally existing content) towards the enhanced canonical.

If reusing existing content is not an option

  1. Generate the new Q&A pair;
  2. Optionally flag your post for diamond attention to make it CW;
  3. Start pointing new questions to the canonical;
  4. If older questions still attract significant views or activity, point them also.

As coldspeed points out in their answer it might be impossible to outshine old heavily upvoted posts with a new Q&A pair.

6
  • I'm a bit confused by the "take it to Meta" idea. Let's assume I post a question like "What do we do about this bad dupe?" - what's Meta gonna do about it? Will they help me edit the question into shape, or what?
    – Aran-Fey
    Commented May 20, 2018 at 20:59
  • @Aran-Fey Old, upvoted, "classical" posts tend to carry a lot of history with them. As such it is wise to ask the community to know how to deal with that specific bad dupe instance rather than taking individual action. What happens from there (Make a new canonical, post a better answer, edit existing answers, or nothing) will depend on each post and their context.
    – Kyll
    Commented May 20, 2018 at 21:32
  • Annoying fuzzy question: would you suggest any serviceable heuristic for what counts as "very popular" or "classical"? I suppose anything near the top of the "frequent" feed for a tag should count; however, I'm rather more interested on the other end of the spectrum: unremarkable questions with half a dozen or so duplicates.
    – duplode
    Commented May 21, 2018 at 4:03
  • @duplode Interesting question, in fact. Sadly this is domain knowledge: A popular question in a low-frequency tag may be 5 upvotes and 300 views, while in a main tag it may be hundred of votes and millions of views. I purposely left some interpretation room because, as with many things on SO, if we had a clear-cut mathematical process we wouldn't need hoomans that much.
    – Kyll
    Commented May 21, 2018 at 5:55
  • "if we had a clear-cut mathematical process we wouldn't need hoomans that much" -- I absolutely agree with the feeling behind that, and I get my question probably isn't really answerable. Part of my concern has to do with niche tags with only a handful of regulars. Simply posting a Meta question about a proposed canonical in such a tag seems unlikely to do much good, as on its own it won't attract the folks with relevant domain knowledge (and will likely end up ignored).
    – duplode
    Commented May 21, 2018 at 11:55
  • "Get the agreement of authors via comments, explain your approach" seems unlikely to work in a lot of cases. Some of the best potential-canonical material is old and abandoned. Commented Jul 1, 2022 at 21:41
3

Should I post a self-answered Q&A about this trivial topic? It would probably be downvoted and closed as a duplicate.

You can absolutely make these and thereby improve the site.

Usually they are not downvoted, but rather the opposite. Particularly if you make them community wiki. Quality matters a lot, as always. I have mostly positive experience from doing this myself, whenever I found a lack of good canonoical dupes.

What's very important to remember when writing self-answered Q&A is:

  • The question must still be of high quality, or at least of the same standard as any other on-topic SO question. Don't type down some one-liner question just so that you'll be able to post an answer - this is the most common mistake people do when writing such Q&A.
  • Make it obvious to the reader that you are attempting to write a canonical Q&A and that you aren't just yet another newbie writing that same question again.

Here are two examples of such Q&A that I've written for C FAQs. I made them both community wiki:

Dynamic memory access only works inside function
Crash or “segmentation fault” when data is copied/scanned/read to an uninitialized pointer

In both cases I start by stating the intention of the Q&A. Then put some manner of MCVE in the question, if applicable.


What you should also do is to ask other veterans in your tag if they know of a good dupe. I believe the community has made some off-site FAQ (here?), so you could start by checking who is maintaining that and offer to contribute. Other tags have on-site FAQs - it is pretty much done differently for every major programming language tag.

I would strongly recommend to try to get together with other users in this. Everyone who's been around long enough with a dupehammer tend to sit on their own private collection of canonical dupe links - so those collections are valuable! If we all share them between us, then that gives better site moderation.

2
  • Excellent examples - thanks for sharing. I commend you for converting the canonicals to community wiki. But let's also be honest. Non-community wiki canonical self-answered Q&As are held to a higher standard: a canonical on str.replace is unlikely to cut it, in my opinion (most likely fails at "not enough research").
    – jpp
    Commented May 21, 2018 at 13:25
  • @jpp The advantage of making it community wiki is that others can contribute too. If you don't make them community wiki then yeah you probably need to have a higher standard. I've done that too, for Q&A where I had put in lots of effort into the answer. But unless it is community wiki, I avoid to use close as dupe with a link to my own posts since I'm partial. In such cases I instead just try to put a comment "possible duplicate of" and let other users decide.
    – Lundin
    Commented May 21, 2018 at 14:28

You must log in to answer this question.

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