I've been playing around with dictionary comprehension, and just as I thought I got the hang of it, I received the error: SyntaxError: dict unpacking cannot be used in dict comprehension
This is the example that I tried:
a = {'a': 1, 'b': 2}
b = {'b': 3, 'c': 4}
{**a, **b} # {'a': 1, 'b': 3, 'c': 4}
{ **c for c in [a, b] } # SyntaxError: dict unpacking cannot be used in dict comprehension
I have seen similar posts which provide work around to this particular issue (mainly Dict merge in a dict comprehension), but I have never seen an explanation as to why it happens.
I found this issue40715, but I couldn't find an answer there either.
If anyone can shed some light on the subject, or redirect me to an article or whatnot I'd be grateful.