[Python-ideas] min_fields argument to str.split()
Robert Lehmann
stargaming at gmail.com
Thu Jan 22 19:25:49 CET 2009
On Wed, 21 Jan 2009 14:55:08 +0100, Mathias Panzenböck wrote:
> Arnaud Delobelle schrieb:
>>
>> How about this?
>>
>>>>> from itertools import *
>>>>> def fixlen(iterable, len, item=None):
>> ... return islice(chain(iterable, repeat(item)), len) ...
>>>>> list(fixlen([1, 2, 3], 5))
>> [1, 2, 3, None, None]
>>
>>
> I like this. Maybe an addition to itertools?
>
> +1
I opened an issue_ at the Python bug tracker.
.. _issue: http://bugs.python.org/issue5034
--
Robert "Stargaming" Lehmann
More information about the Python-ideas
mailing list