Return at least X results from split
<p><a href="http://docs.python.org/library/stdtypes.html#str.split" rel="nofollow">split</a> has a maxsplit parameter, which is useful when you want <em>at most</em> X results. If there something similar to return <em>at least</em> X results and populate the rest with <code>None</code>s. I'd like to be able to write</p>

<pre><code> a, b, c = 'foo,bar'.magic_split(',', 3)
</code></pre>

<p>and have <code>a=foo</code>, <code>b=bar</code> and <code>c=None</code>. </p>

<p>Any ideas how to write such a function?</p>

<p>Upd. I ended up with a solution which is a combination of <a href="http://stackoverflow.com/a/9294793/989121">this</a> and <a href="http://stackoverflow.com/a/9294073/989121">this</a> answers:</p>

<pre><code>&gt;&gt;&gt; def just(n, iterable, fill=None):
...     return (list(iterable) + [fill] * n)[:n]
... 
&gt;&gt;&gt; just(3, 'foo,bar'.split(','))
['foo', 'bar', None]
</code></pre>
