I am not able to understand why this syntax produces an empty set by tuple unpacking? In other words, I am not sure how this works. I would appreciate if someone explains this.
It seems that the starred syntax is only used for creating a set so that’s what you get even though it’s an empty one-
I think the OP wants to understand it logically. He wants to understand why unpacking the tuple inside the curly braces
I’m not sure there’s much more to it, the parser interprets this as creating a set instead of an empty dictionary, the fact that it’s an empty tuple being unpacked doesn’t seem to matter.
My first response was trying to approach this logically but I believe it’s the syntax used that results in a set here.
That seems like nicer behaviour too. If you were passing and unpacking an iterable in this way you must be trying to create a set, if your iterable was empty and suddenly you got a dictionary instead then it would be even more confusing.