Lately I’ve been writing a lot of code as follows:
def some_function() -> dict:
output: dict = {
"success": False
}
r: requests.Response = requests.get(
# url, headers, params
)
if r.ok:
output["success"] = True
output["api_response"] = r.json()
return output
I find it useful but it seems to me that I’m borrowing from Golang instead of writing pythonic code. What is the correct way of doing something like this?