Starred expressions raise SyntaxError when used in list or generator comprehension.
I'm curious about the reason behind this; is it an implementation choice or there are technical constraints that would prevent this operation?
I've found a lot about the contexts that don't allow for unpacking iterables but nothing about why.
Example:
lis = [1, 2, 3, 4, 5]
listcomp = [*lis for i in range(3)]
I thought maybe I could use this to get [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5] as a result, but it raises
SyntaxError("Iterable unpacking cannot be used in comprehension")