Re: [Python-Dev] Proposal for a new itertools function: iwindow

2006-05-28 Thread Nick Coghlan
Raymond Hettinger wrote: No thanks. The resolution of this one was that windowing iterables is not a good idea. It is the natural province of sequences, not iterables. With sequences, it is a matter of using an index and offset. With iterables, there is a great deal of data shifting.

Re: [Python-Dev] Proposal for a new itertools function: iwindow

2006-05-27 Thread Aahz
On Thu, May 25, 2006, Torsten Marek 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

Re: [Python-Dev] Proposal for a new itertools function: iwindow

2006-05-27 Thread Giovanni Bajo
Aahz [EMAIL PROTECTED] 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

Re: [Python-Dev] Proposal for a new itertools function: iwindow

2006-05-27 Thread Raymond Hettinger
Aahz [EMAIL PROTECTED] 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

Re: [Python-Dev] Proposal for a new itertools function: iwindow

2006-05-27 Thread Nick Coghlan
Raymond Hettinger wrote: Aahz [EMAIL PROTECTED] 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

Re: [Python-Dev] Proposal for a new itertools function: iwindow

2006-05-27 Thread Raymond Hettinger
From: Nick Coghlan [EMAIL PROTECTED] A python-dev Google search for itertools window found me your original suggestion to include Jack Diedrich's itertools.window in Python 2.3 (which was only deferred because 2.3 was already past beta 1 at that point). I couldn't find any discussion of the

[Python-Dev] Proposal for a new itertools function: iwindow

2006-05-26 Thread Torsten Marek
Hi, in the last time, I've found myself reimplementing a generator that provides a sliding-window-view over a sequence, and I think this function is of a greater usefullness, so that it might be included in itertools. Basically, what the generator does it return all m consecutive elements from a