Why is `[] = []` a valid statement in Python?

71 views Asked by At

I was surprised to learn that

[] = []

is a perfectly valid Python statement (with no effect). Also:

[] = tuple()
[] = set()
[] = {}

I gather it's trying to unpack the iterables on the right hand side, but what's an iterable doing on the left hand side of an assignment?

0

There are 0 answers