https://stackoverflow.com/a/40429822/864112
It boggles the mind that anyone could ever suggest this as a solution.
https://stackoverflow.com/a/40429822/864112
It boggles the mind that anyone could ever suggest this as a solution.
> This is akin to answering "how do I bake a cake?" with "open up a bakery, walk inside, and ask for a cake"
Only it's more like answering "how much does this cake cost" by purchasing the cake and looking at the receipt.
Or should I say... analogies are like Uber, but for metaphors. No. I should stop before writing that.
Except the java.net.URL.equals and java.net.URL.hashcode methods do almost the same thing: they issue DNS requests (!)
"Two hosts are considered equivalent if both host names can be resolved into the same IP addresses; else if either host name can't be resolved, the host names must be equal without regard to case; or both host names equal to null."
See https://docs.oracle.com/en/java/javase/11/docs/api/java.base...
There is a bug raised[1], but it can't be fixed for backwards compatibility reasons.
I'll never forget this now, after debugging a very horrible and severe and very intermittent performance issue in some code over 20 years ago. A (slow) DNS resolver occasionally caused 1000x performance degradation on remote sites. That was horrible to work out.
[1] https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4434494
Good.
etc
EDIT: Apparently the answer was edited by another user just recently making the clarification.
Shame about the hostile reaction from others towards your question. Keep asking questions (especially things that are presented without comment), and don't be afraid that doing so will make you look stupid or that you should feel like you should be punished for it.
0. https://blog.imgur.com/wp-content/uploads/2017/06/mocking.jp...
I agree that your parent is a good question that should have been well received, but, as far as I can tell, it was. Where do you see a hostile reaction? In fact the only hostility I see in this thread is what you directed at Python, which, in this context, seems unmotivated; it is surely true that one can write code in any language whose full import isn't immediately apparent. At the moment, the only other response to your parent is from hvdijk, saying (https://news.ycombinator.com/item?id=27534803):
> The question was how to build a URL, not how to send off a request to it. The answer sends off a request and then inspects the response to see what URL was used. If you wanted to send off the request, inspecting the URL on the result is probably not useful. If you didn't want to send off the request, doing it this was is wasteful or even harmful.
This seems like a response that takes the question seriously and addresses it clearly, just as it should.
That comment is, just like the downvotes the question received, precisely the sort of thing that discourages asking honest questions rather than welcoming them. Note that by the way it is written it, too, assumes that it is both obvious and understood that Python's request.get will "send off a request"—instead of merely building a request and returning it to you. Rather than just straightforwardly answering the question (by explaining what this part of the Python' standard library is actually doing—which is the relevant missing piece here, and which no one should be expected to know) the quoted comment ("The question was how to build a URL, not how to send off a request to it") pins the misunderstanding on the questioner by tacitly implying the questioner isn't paying attention to something else entirely different.
The comment, when considered in full and in context, actually has the effect of subtly discouraging/admonishing the questioner (and likeminded people with the same question) for failing to recognize something that is, to the sophomoric Python crowd, obvious and worthy of ridicule—which is what maest's thread was all about, by the way (and almost certainly why it got moderated).