Answer the question
In order to leave comments, you need to log in
Why is the response type passed to the method as a variable?
Most web frameworks use the following construct: It's
not clear why resp is always passed into the handler function. It's the same answer. We do not accept it, but must return it. def on_get(self, req, resp):
Answer the question
In order to leave comments, you need to log in
So that you do not copy-paste the response constructor everywhere, a blank is passed. And yes, not "in the majority", but in asynchronous / non-blocking ones, because in synchronous response classes are primitive and are used only after the response is completed.
This is the object that you must complete. In functional languages, this could well be a return value, but it is difficult to pass it to another asynchronous function. Synthetic example:
From the less synthetic examples, the need to make an asynchronous request in order to eventually form a response
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question