17

I would like to demonstrate what I am asking with an example:

  • I wanted to know what are the benefits of importing at the beginning of file or elsewhere in python.
  • A search showed this protected question with title "Should Python import statements always be at the top of a module?".
  • This question had the tag "optimization" (and this was the tag that appeared in the link of the google search) and the OP was asking specifically about the performance implications on imports.
  • There are answers that discuss optimization implications but then others started answering where the import statements should be positioned for other reasons (like circular dependencies and modularity) (which actually answer the title but not exactly what was asked).
  • Those "out of scope" answer however are indeed informative and useful and pretty much solve someone's questions on where should the imports be.

The problem here is that somebody searching for all the implications may dismiss that post because the OP asks about optimization, and also some new questions about imports are marked as duplicates because of the answers and the misleading title mentioned above.

So, what can / should be done in this regard? Or it is not a problem at all and people should just search more in depth?

Or, a tl;dr version:
What is there to be done when a title is broader than the question itself and answers have already targeted both of those?

13
  • 4
    This is why it's important for answers to actually answer the question asked. Information when useful when you have a different question than the one asked doesn't mean it's a useful answer to the question that was asked.
    – Servy
    Commented Jan 24, 2018 at 17:08
  • Totally agree, but what can we do now that it is already happened and especially in a protected post?
    – kyriakosSt
    Commented Jan 24, 2018 at 17:12
  • The same thing you do with any answer you see that isn't useful.
    – Servy
    Commented Jan 24, 2018 at 17:13
  • 1
    But the point is that this is a "big" post and any other ones that ask the question the "useless" answers target get closed as duplicates because of those answers and the misleading original title.
    – kyriakosSt
    Commented Jan 24, 2018 at 17:19
  • 8
    @Servy I think thats a fairly over simplified and useless way of looking at the situation. There are many options formoving forward other than downvoting a useful answer, which ultimately solves nothing at all.
    – user4639281
    Commented Jan 24, 2018 at 18:55
  • 2
    @TinyGiant But it's not a useful answer to the question. It might be useful to someone who isn't actually looking for a solution to that problem. If it were posted as an answer to a question that it actually answered, then it would be useful.
    – Servy
    Commented Jan 24, 2018 at 18:59
  • @Servy What are those other options actually?
    – kyriakosSt
    Commented Jan 24, 2018 at 19:24
  • I mean the best option would be to find a proper home for the answer if one exists or make one if it doesn't and do something about it. Downvoting a useful answer because it is in the wrong place is not helping the situation, it's just throwing sand in the wind. @Servy
    – user4639281
    Commented Jan 25, 2018 at 6:16
  • 1
    Ultimately in this case the answer in question does address the question "Should Python import statements always be at the top of a module?", even though not necessarily the secondary question of "surely it is more efficient to do the import when it is needed?". The question is asking whether they should always put the imports at the top as the docs suggest, the answer points out situations where you should not. Most of the answers there talk less about the performance part than they do about reasons for or against doing so.
    – user4639281
    Commented Jan 25, 2018 at 6:24
  • @TinyGiant Sure, by all means find a home for the answer where it would be useful. But that doesn't mean that the answer is useful in a place where it doesn't belong. Claiming that random answers to questions unrelated from the one asked are useful just isn't true, even of those answers would be useful if they were actually posted to a question that they answer. If the answer were posted somewhere appropriate it would be useful, but it wasn't, so it isn't useful. Information isn't useful or not useful regardless of the context; context matters.
    – Servy
    Commented Jan 25, 2018 at 14:30
  • @TinyGiant You're making the same mistake as that answer. You're looking at the title of the question, and ignoring the rest of it as if it didn't exist. But it does exist, and the question isn't just what is in the title.
    – Servy
    Commented Jan 25, 2018 at 14:31
  • @Servy i find your view of the situation disturbing.
    – user4639281
    Commented Jan 25, 2018 at 14:50
  • @TinyGiant I find your view of the situation disturbing.
    – Servy
    Commented Jan 25, 2018 at 14:51

2 Answers 2

3

What is there to be done when a title is broader than the question itself and answers have already targeted both of those?

An otherwise informative answer that you can't find is the same as a non-existent answer that you can't find. Neither is useful.

That said, voting on Stack Overflow is necessarily a subjective endeavor. It is up to each person to decide whether they find an answer "useful" or "not useful". And frankly, even the first step of that decision-making process is subjective. One person reading a question might decide that the question is only about performance implications, while another person reading the exact same question might decide that performance implications were simply mentioned as an example of why one might choose one method over another.

Which is in fact the case on the question you've referenced. It's my opinion that the question was not only titled broadly, but also asked broadly. Yes, the author is using performance as their specific example. But I wouldn't say that the wording of the question necessarily rules out answers that address other factors.

To me, the most important things are "does this answer address the question that was asked?" and "is someone who needs or wants this information going to be able to find it in the future?"

I've found Stack Overflow's search engine to be relatively unsophisticated, and the "relevance" score seems primarily tied to the wording of the title. Given the broad wording of the title in the question you've referenced, it seems likely that anyone looking for any information that relates to placement of imports in a Python module is going to find that question (and indeed, you did).

We do have examples of answers that answer a completely different question than the one that was asked. And I do down-vote those answers. Those answers fail to help the author of the question, and they are so far removed from the original topic that they aren't going to help anyone else either. They are not useful.

But in the example you've provided, it seems to me that any answer that legitimately and correctly addresses the topic of where to place imports, can in fact be considered as "useful" and deserving of an up-vote, or at least not deserving of a down-vote.

In any case, the answer to your question really boils down to the same as would be for dealing with any answer on Stack Overflow: up-vote if you believe it's useful, down-vote if you believe it's not, and leave it alone if you're unsure. This is not unique to the scenario where answers address a question more broadly than originally stated, whether or not one thinks that's the type of scenario you've referred us to here.

10
  • >implying Stack Overflow search is ever used for anything but futile duplicate searches ;)
    – BoltClock Mod
    Commented Jan 25, 2018 at 5:12
  • @BoltClock: point taken. :) That said, while I often wish it were easier, I do find duplicates reasonably regularly. If I were smarter I'd use Google or Bing instead (when I remember to try them, they often do much better). But for a lot of questions, it is embarrassingly easy to find duplicates, even using Stack Overflow's search. Commented Jan 25, 2018 at 7:47
  • Ah, @peter, but they do help people. You just don't hear about it. It's not always true, but frequently it is. Those answers often are useful to somebody, even if not the original author of the question.
    – jdmayfield
    Commented Jan 27, 2018 at 10:03
  • 2
    @jdmayfield: "they do help people" -- nope. By definition, an answer that can't be found, does not help people. Commented Jan 27, 2018 at 17:07
  • @peter, I have to agree I find it annoying when someone posts an answer to my question that doesn't actually address it, but it doesn't hurt anything. It might even be useful for some other purpose, maybe not for me, but for somebody. I particularly don't like it when someone appears to not have read the post, but sometimes it's still useful in giving me the impetus to re-evaluate, and re-phrase or further elaborate on the topic for clarity. That does not prevent getting or finding a specific answer to a specific question. But it does make people think. That alone makes it useful.
    – jdmayfield
    Commented Jan 28, 2018 at 0:36
  • I think what makes SO such a great site is not just the answers to the questions, but that in their attempt to ask, and to answer, and to provide insights through comments, it helps individuals to grow and to think of things in new in different ways, and to point out reasons you may sometimes want to do, or not do, things a certain way at different times. In the example question for instance, the simple answer is 'no', as 'always' simply evaluates down to 'false'. But an important qualifer is usually it is true, but sometimes it is not. Language is subjective, even in programming.
    – jdmayfield
    Commented Jan 28, 2018 at 0:47
  • 1
    @jdmayfield: thanks for your input. we will just have to agree to disagree. Commented Jan 28, 2018 at 0:51
  • Yes, @peter. Well put. I love it that we can do that here. All respect to you.
    – jdmayfield
    Commented Jan 28, 2018 at 1:00
  • 1
    This last pair of comments between you and @jdmayfield is a far cry from the pair between Tiny Giant and Servy under the question...
    – BoltClock Mod
    Commented Jan 28, 2018 at 7:46
  • @bolt, I have to admit, I overlooked that exchange. Sometimes people get a bit emotional about these things. It is, apparently, a hot debate. Personally, I prefer to present and recieve argument with a grain of salt, and generally respect the opinions of others even if they are at odds with my own. It encourages us toward mutually beneficial interactions, and allows us to grow. But that is just me. On the other hand, it is umm.. somewhat humorous-- and could be useful in the context of being human, for someone who might need a little laugh. ;)
    – jdmayfield
    Commented Jan 28, 2018 at 8:15
0

Look, I've only been a member for like a year or so, but I've been directed to SO for answers from Google and elsewhere, that get really specific answers to what I'm looking for, for as long it's existed. Face it, SO's search bites. And what is the purpose of the site? To help people grow as developers. Not only to answer a question-- because if that was the case, duplicates wouldn't be an issue.

I have seen so much complaining about this kind of thing since I actively joined-- lIke it's some burden-- it makes me very sad, to put it mildly. Are we here to learn and to help people? Or just stroke our ego's.

This question is the perfect example of what I go to Stack for. I have learned so much from divergent topics here, I'd say it's probably number 1 if I had to list them (0 on the index being reserved for pure, unadulterated experimentation).

In the example provided, the seemingly divergent answers are still solidly linked, and important, to the question. Because what is most efficient is not always what is best. You don't know the querants complete scenario, and someone may come across such a question doing research and do a bunch of optimization on their project, and totally destroy functionality for themselves or others depending on what it's connected to-- had they not seen those other, seemingly divergent answers. Other people will come across that post looking for something different that a search brought them there for-- and find a stack of gold in the form of knowledge they might never have otherwise been exposed to. I am one of them.

I love coming across posts with juicy tidbits that weren't quite what I was looking for-- but the one I came for is there. It is not obscured by TMI. I can read, and there are these wonderful search utilities in my browser to help me narrow things down.

As for duplicates-- so what? Would you rather have 'too many' copies of your favorite book, movie, or song (in this case functions, methods, algorithms, etc) or none at all? Because that's what I see happening. If people are more concerned about posting a duplicate than giving an answer, there will be information lost. You can never have too many backups. And some of those duplicates provide quicker answers. More prominent dates at the top of the page and in the title would be really nice though, because in our field, a lot of things change, and sometimes rather quickly.

Let people be people. It keeps things fresh. Let them express their thoughts. Don't downvote someone because they didn't find the answer and had to ask. If it was easy for them they wouldn't be here, seeking wisdom at the feet of the masters. There are no stupid questions, if asked in earnest. What is stupid is not to ask if you can't find the answer when you need it. Some of us have money riding on these questions-- our livelihood, our families well-being. Or posterity. Whutevs.

What if you came up with a working time machine, or some engenious device that could save the world, or at least bring joy to hundreds of people and put some money in your pocket to pay your rent and feed your kids... and what stopped you was someone telling you your question had already been asked and had an answer... but didn't provide a link. Or gave you a thumbs down to your face in front of thousands of people with no reason provided. And your search terms came up with nothing even relating to your actual problem.

I am a one-in-two-billion person. I am not the smartest, or the quickest, or the strongest, or the most beautiful. But I've had some extensive testing over the years, and it turns out I have some rather unusual abilities involved with patterns in languages and shapes. This has given me a much different perspective, because when I was younger, it seemed to me like everyone was stupid. I couldn't understand why they didn't see what was obvious-- to me, that is. As I grew older, my perspective changed as I could envision what it was like-- not seeing the obvious. All I'm saying is that's why we're here, I hope, to help each other get a better perspective, to learn. Because sometimes what's obvious from one perspective, is obscure from another.

Probably, I will get some downvotes for this. But this is what I think. Better too much information than no information.

3
  • 1
    Or to sum up the tl;dr: a book is always broader than it's title. 'Those "out of scope" answer however are indeed informative and useful and pretty much solve someone's questions on where should the imports be.' This is why God made search engines.
    – jdmayfield
    Commented Jan 27, 2018 at 9:58
  • I think duplicates are a separate issue entirely... many duplicates get asked each day that can be found even with Stack Overflow's atrocious search, let alone Google's vastly superior and ubiquitous search engine. If that isn't an insult to the asker's research skills, I don't know what is.
    – BoltClock Mod
    Commented Jan 28, 2018 at 7:38
  • 1
    I wholeheartedly agree with everything you've said re: divergent answers. There is nothing else for me to add.
    – BoltClock Mod
    Commented Jan 28, 2018 at 7:44

You must log in to answer this question.

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