Assigning empty list
<p>I don't really know how I stumbled upon this, and I don't know what to think about it, but apparently <code>[] = []</code> is a legal operation in python, so is <code>[] = ''</code>, but <code>'' = []</code> is not allowed. It doesn't seem to have any effect though, but I'm wondering: what the hell ? </p>

<p>This is related to Python's multiple assignment (sequence unpacking):</p>

<pre><code>a, b, c = 1, 2, 3
</code></pre>

<p>works the same as:</p>

<pre><code>[a, b, c] = 1, 2, 3
</code></pre>

<p>Since strings are sequences of characters, you can also do:</p>

<pre><code>a, b, c = "abc"    # assign each character to a variable
</code></pre>

<p>What you've discovered is the degenerative case: empty sequences on both sides. Syntactically valid because it's a list on the left rather than a tuple. Nice find; never thought to try that before!</p>

<p>Interestingly, if you try that with an empty tuple on the left, Python complains:</p>

<pre><code>() = ()            # SyntaxError: can't assign to ()
</code></pre>

<p>Looks like the Python developers forgot to close a little loophole!</p>

python list binding