Clean Python: prefer dict() over {} for simple keys
TL;DR
Prefer dict() over {} when keys are simple literals that are valid Python identifiers. With dict() we avoid noisy apostrophes around keys.
Rationale
Get less visual noise by avoiding repetitive apostrophes. This is especially beneficial when dealing with dictionaries where keys are naturally simple, like HTTP/URL params.
Consider which param list is easier to read:
params = {‘id’: 1234, ‘page’: 2, ‘limit’: 20, ‘v’: 0}
params = dict(id=1234, page=2, limit=20, v=0)
There is just fewer symbols involved and actual pairs are easier to grasp in the dict() version. Drop the apostrophes.
Additionally, specifically in the context of HTTP/URL params, the equal sign is more natural than colon because this is how they look in the wild.
Fall back to {} literal for any other keys like not-strings, uppercase strings, strings with whitespace, etc. Basically everything that is impossible to express or would look stupid in the dict() version.