-16

So 13 months ago I was tripping over escaping a string just right to get a regex working. The question was posted, and I got an answer which helped me figure out what I did wrong. SO FTW.

Fast-forward to last week, we can see from the question history (with a total of 110 views), on the same day:

  • an edit to the tags on the question: remove python-3.x, add python (since the second individual has a gold python badge - but not a gold python-3.x?)
  • question-closure with a question already answered here reason

IMHO the re-tagging of the question to gain additional power to make unilateral changes is one thing, but my biggest issue is with the rationale for the close:

While the linked question does address a similar topic/question (backslashes for escaping characters in Python strings), in no way could its answers have single-handedly helped answer/address the OP, even today.

Closing a question because a different question has a similar answer seems counter-productive to me. I frequently see Contributors point to existing answers (to different questions) that apply to the OP's question - but a different question remains a different question, even if they have the same answer.

8
  • 12
    The tag change seems to be because the question isn't about Python 3.x specifically. The duplicate closure seems to be correct, although there might be a better dupe available somewhere. In overall, I don't know what you see wrong with the actions taken on this post.
    – Dharman Mod
    Aug 16, 2022 at 19:01
  • 4
    err... isn't the linked one directly about backslashes? "Why do backslashes appear twice?"?
    – Kevin B
    Aug 16, 2022 at 19:13
  • let me re-read everything after this call... Aug 16, 2022 at 19:18
  • 21
    "IMHO the re-tagging of the question to gain additional power to make unilateral changes is one thing" Users cannot vote-to-close unilaterally (see: Mjolnir; dupehammer) for a tag when they are the one who adds the tag, FYI. So there is no "gain addtional power" happening here.
    – TylerH
    Aug 16, 2022 at 20:42
  • 18
    FWIW, All Python questions should be tagged python. That includes Python 3 questions. So don't be concerned if you see someone adding that tag when it is missing... adding the tag is the right thing to do, regardless of any other action taken on the question.
    – TylerH
    Aug 16, 2022 at 20:43
  • 1
    "I frequently see Contributors point to existing answers (to different questions) that apply to the OP's question - but a different question remains a different question, even if they have the same answer." And that is exactly the point of duplicate closure. So that all the different ways to ask for basically the same issue do point to the same answers. Aug 17, 2022 at 8:04
  • 1
    @AdamSmooch Every not-deleted question is searchable. While closure makes deletion more likely, it is not a necessity that closed questions are deleted. Aug 17, 2022 at 17:13
  • Thanks for clarifying - +1 and deleted my previous comment (unable to edit 🤔) Aug 17, 2022 at 17:19

1 Answer 1

28

I am the retagger and cast one of the close votes. I found this question while doing a general sweep for undetected duplicates of questions about backslashes qua string and/or regex escapes.

an edit to the tags on the question: remove python-3.x, add python (since the second individual has a gold python badge - but not a gold python-3.x?)

The question is not in any way 3.x specific, and every 3.x question is a Python question anyway. (Which reminds me, I wanted to discuss better ways to handle these kinds of tags.)

IMHO the re-tagging of the question to gain additional power to make unilateral changes is one thing

Re-tagging the question did not give me this power - since the question never previously had the Python tag, it prevented me from wielding Mjollnir. However, PM 2Ring also has a gold badge, and thus was able to close the question afterwards without waiting for a third person. I solicited the help; PM evidently agreed with my assessment.

While the linked question does address a similar topic/question (backslashes for escaping characters in Python strings), in no way could its answers have single-handedly helped answer/address the OP, even today.

I voted to close the question because - after reading the accepted answer - I concluded that the OP hadn't actually had a problem figuring out the regex, but instead misinterpreted the output.

The second example in the OP:

>>> re.sub(r'(.*?)(".*?)',r'\1\\\2',data, re.MULTILINE)
'    {\n        value1: \\"blah\\",\n        value2: \'foo<a href=\\"example.com\\">bar</a>\',\n    }'

gives the correct result, as explained in the accepted answer and as seen in the update. The accepted answer is about explaining why that result is correct - which is the same problem as in the linked duplicate, with the same explanation. "Backslashes appear twice", as the linked duplicate puts it, because single backslashes in the actual text need to be escaped in the string's representation. The string correctly contains a single backslash in each intended position.

I agree that the question is not useful as a duplicate - nobody with that string backslash problem would ever use search terms that would realistically find this question. Which is why I'm also voting to delete it.

If it were asked today, I very likely would hammer it with the same duplicate target. Unless it appeared that the conceptual problem was understood and this was just an oversight, in which case the question should instead be closed as not reproducible.

You must log in to answer this question.

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