Re: funny generator behaviour

2008-12-04 Thread Arnaud Delobelle
Edvin Fuglebakk <[EMAIL PROTECTED]> writes: > I have written a generator that puzzles me: > > The generator is supposed to create ordered selections of a set of > objects. repetition of objects is allowed and the selections should be > of a size determined by a pramter to the generator. > > Now, i

Re: funny generator behaviour

2008-12-04 Thread pruebauno
On Dec 4, 8:00 am, Edvin Fuglebakk <[EMAIL PROTECTED]> wrote: > I have written a generator that puzzles me: > > The generator is supposed to create ordered selections of a set of > objects. repetition of objects is allowed and the selections should be > of a size determined by a pramter to the gene

Re: funny generator behaviour

2008-12-04 Thread pruebauno
On Dec 4, 8:00 am, Edvin Fuglebakk <[EMAIL PROTECTED]> wrote: > I have written a generator that puzzles me: > > The generator is supposed to create ordered selections of a set of > objects. repetition of objects is allowed and the selections should be > of a size determined by a pramter to the gene

Re: funny generator behaviour

2008-12-04 Thread Aaron Brady
On Dec 4, 7:00 am, Edvin Fuglebakk <[EMAIL PROTECTED]> wrote: ... > def orderedCombinations(pool, k): >     """ >     Generator yielding ordered selections of size k with repetition from > pool. >     """ > >     if k == 1: >         for m in pool: >             yield [m] > >     if k > 1: > >    

Re: funny generator behaviour

2008-12-04 Thread pruebauno
On Dec 4, 8:00 am, Edvin Fuglebakk <[EMAIL PROTECTED]> wrote: > I have written a generator that puzzles me: > > The generator is supposed to create ordered selections of a set of > objects. repetition of objects is allowed and the selections should be > of a size determined by a pramter to the gene