partial list unpack in python
<p>In python, assignment operator can unpack list or tuple into variables, like this:</p>

<pre><code>l = (1, 2)
a, b = l # here goes auto unpack
</code></pre>

<p>But i need to specify exactly same amount of names to the left as an items count in the list to the right. But sometimes i don't know a size of the list to the right, for example if i use split(). Example:</p>

<pre><code>a, b = "length=25".split("=") # this will result in a="length" and b=25
</code></pre>

<p>But the following code will lead an error:</p>

<pre><code>a, b = "DEFAULT_LENGTH".split("=") # error, list has only 1 item
</code></pre>

<p>is it possible to somehow unpack list in the example above so i get a = "DEFAULT_LENGTH" and b equals to 'None' or not set? Straightforward way looks kinda long:</p>

<pre><code>a = b = None
if "=" in string :
  a, b = string.split("=")
else :
  a = string
</code></pre>
