[Python-Dev] Proposal for a new itertools function: iwindow
Giovanni Bajo
rasky at develer.com
Sat May 27 18:06:44 CEST 2006
Aahz <aahz at pythoncraft.com> wrote:
>> Some open question remain:
>> - should iwindow return lists or tuples?
>> - what happens if the length of the iterable is smaller than the
>> window size, and no padding is specified? Is this an error? Should
>> the generator return no value at all or one window that is too small?
>
> You should probably try this idea out on comp.lang.python; if there is
> approval, you'll probably need to write a PEP because of these issues.
> Note that my guess is that the complexity of the issues relative to
> the benefit means that BDFL will probably veto it.
A PEP for adding a simple generator to a library of generators??
The function does look useful to me. It's useful even if it returns a tuple
instead of a list, or if it doesn't support padding. It's still better than
nothing, and can still be succesfully used even if it requires some smallish
wrapper to achieve the exact functionality. I know I have been implementing
something similar very often. Since when do we need a full PEP process,
nitpicking the small details to death, just to add a simple function?
Giovanni Bajo
More information about the Python-Dev
mailing list