I ran across How to find a string from a ZIP file using Python today. With all the changes in SO's mission emphasis (now much, much more on "welcoming" than in the past), I find myself unsure about how the company/staff expects us to evaluate the quality of a question.
This specific situation
The question I linked above presents a straightforward problem and asks for help debugging its behavior. They include a reasonable MCVE of an attempt at solving the problem, their desired behavior, and the behavior they're observing instead. If you know how to solve it, the change required is fairly trivial (just change f1.readlines()
to f1.read().decode('utf-8')
or whatever text encoding the file uses).
But beneath that surface simplicity lies a lot of underlying complexity. Specifically, the author of the question appears to be missing quite a lot of information that would allow them to arrive at the solution.
You can skip this gobbledygook if you're unfamiliar with Python, as the details don't really matter. But to go over what specifically makes the problem complex:
In the comments, you can see that they're not familiar with the differences between the binary (
bytes
) and text (str
) types and how to convert between them (thedecode
call I mentioned above):the error i faced when i used read() . 'if files in f1.read():TypeError: a bytes-like object is required, not 'str' ' . r = f1.readlines() returns a list and i am not able to find a way to find a string in that list
They don't grasp that the
in
operator does not perform a contains check on each element of the list, but rather performs an equality check against each element. This is evidenced by the fact they need assistance, rather than solving the problem themselves.Given that they are not familiar with the differences between binary and text types, it is also highly likely they are not familiar with text encodings and the issues surrounding them. They must learn about this topic to determine the correct encoding to apply.
There is also a concern with respect to styles of newlines. It's not clear if they wish to normalize the newlines, consider differences, or disallow the search string from containing them, which would allow them to be ignored. That they did not include information about this detail suggests they may not be aware of these issues, either.
The accepted answer was also wrong at the time it was accepted. It converted the list of lines into the repr, which formats the list into a literal expression (including the list brackets, quote marks, and escape sequences). That the asker did not recognize this also indicates they are missing knowledge about
str
and how it behaves on lists.
The kind of answer I would expect
If someone were to answer this question, I would expect the answer to cover all or at least most of these points of confusion. My understanding is that participants in SO are not supposed to simply hand the answer to the author, but explain why it's the best answer. This is partly because providing such an explanation allows the reader to make an informed decision about any caveats and whether the solution is appropriate for their use case, and it also teaches the user how to think about their problem and what pitfalls to watch for so they can solve related ones in the future without help.
The problem
The problem is that all the topics I mentioned are rather in depth. Each one is worthy of at least a separate, more specific question and answer. All of those points of information are also most likely duplicated elsewhere on the site.
This, in my opinion, makes the question Too Broad because a proper answer covers too many topics and too much information. This is why I refrained from answering and cast a downvote.
Generalizing
This is a specific example of a common problem on SO. A user asks a question that can be given a simple answer without explaining any concepts in detail, but as soon as you start to try to untangle the asker's misunderstandings and inform them of information they're missing, the answer balloons into something unmanageable and too time consuming to create.
Most of the questions I see exhibit problems of this nature, where the author does not appear to possess base knowledge of multiple relevant concerns for their problem. The asker also frequently demonstrates that they are perfectly satisfied with even a poor answer that appears to work in limited use cases but fails just beyond their immediately presented one.
The question: What does SO (the company) expect us to do about these kinds of situations?
What is the current expectation of how we are to treat such questions?
Is downvoting considered appropriate? Is close voting appropriate? Or is the fact a brief answer that fixes the presented code enough to make it on topic? Are the upvotes on the question and answer appropriate? Have the expectations on such questions changed in light of recent shifts in company focus (e.g., the "welcoming" push)?
Are my standards for an answer too high? Are such explanations and information not expected? Are my expectations about addressing points of confusion described above in line with the company's perspective? Or is it appropriate to post such brief answers on questions with so many underlying issues?
I would very strongly prefer a response from staff, or at least an answer backed up by statements from staff.