Joh wrote:
>> def gen(iterable, start, end):
>>it = iter(iterable)
>>while True:
>>it, a = tee(it)
>>a = tuple(islice(a, end-1))
>>for sz in xrange(start, len(a)+1):
>>yield a[:sz]
>>it.next()
>>
>> if __name__ == "__main__":
>>print list(gen(range(1, 5), 2, 4))
>
> please, this one looks interes
Thank you,
I immediately download version 2.4, switching from version 2.3.
Francis Girard
FRANCE
Le vendredi 21 Janvier 2005 17:34, Craig Ringer a ÃcritÂ:
> On Fri, 2005-01-21 at 16:54 +0100, Francis Girard wrote:
> > First, I think that you mean :
> >
> > consecutive_sets = [ x[offset:offset+su
On Fri, 2005-01-21 at 16:54 +0100, Francis Girard wrote:
> First, I think that you mean :
>
> consecutive_sets = [ x[offset:offset+subset_size]
> for subset_size in xrange(2, len(x))
> for offset in xrange(0, len(x) + 1 - subset_size)]
>
> (with square
Le vendredi 21 Janvier 2005 16:06, Craig Ringer a ÃcritÂ:
> On Fri, 2005-01-21 at 22:38 +0800, Craig Ringer wrote:
> > consecutive_sets = ( x[offset:offset+subset_size]
> > for subset_size in xrange(2, len(x))
> > for offset in xrange(0, len(x) + 1 - subset
Joh wrote:
> i'm trying to understand how i could build following consecutive sets
> from a root one using generator :
>
> l = [1,2,3,4]
>
> would like to produce :
>
> [1,2], [2,3], [3,4], [1,2,3], [2,3,4]
>
> but unfortunately can not, i guess i can do it by using sub generator
> and maybe e
On Fri, 2005-01-21 at 22:38 +0800, Craig Ringer wrote:
> consecutive_sets = ( x[offset:offset+subset_size]
> for subset_size in xrange(2, len(x))
> for offset in xrange(0, len(x) + 1 - subset_size) )
Where 'x' is list to operate on, as I should've initial
On Fri, 2005-01-21 at 17:14 +0300, Denis S. Otkidach wrote:
> On 21 Jan 2005 05:58:03 -0800
> [EMAIL PROTECTED] (Joh) wrote:
>
> > i'm trying to understand how i could build following consecutive sets
> > from a root one using generator :
> >
> > l = [1,2,3,4]
> >
> > would like to produce :
> >
Joh wrote:
hello,
i'm trying to understand how i could build following consecutive sets
from a root one using generator :
l = [1,2,3,4]
would like to produce :
[1,2], [2,3], [3,4], [1,2,3], [2,3,4]
Do you mean:
[1,2], [2,3], [3,4], [1,2,3], [2,3,4], [1,3,4]
(E.g. all elements in the power set e
On 21 Jan 2005 05:58:03 -0800
[EMAIL PROTECTED] (Joh) wrote:
> i'm trying to understand how i could build following consecutive sets
> from a root one using generator :
>
> l = [1,2,3,4]
>
> would like to produce :
>
> [1,2], [2,3], [3,4], [1,2,3], [2,3,4]
>>> def consecutive_sets(l):
...