I came across this piece of Python code. The precise function is not important. I'm trying to understand how the arguments to the json.dumps call work. It looks (at a guess) like the intent is to use either body or kwargs['body'] depending on which one is non-null, but doesn't the or operator just return a boolean?
import json
from aiohttp import web
def json_response(body='', **kwargs):
kwargs['body'] = json.dumps(body or kwargs['body']).encode('utf-8')
kwargs['content_type'] = 'text/json'
return web.Response(**kwargs)