Re: list() strange behaviour

2021-01-23 Thread Barry
> On 23 Jan 2021, at 17:23, Avi Gross via Python-list > wrote: > > I am wondering how hard it would be to let some generators be resettable? That is generally thought to be a bad thing in OOD. Classes that reset are usually a code smell and often a source of bugs. Why not just assign a new

Re: list() strange behaviour

2021-01-23 Thread Chris Angelico
On Sun, Jan 24, 2021 at 8:49 AM Cameron Simpson wrote: > > On 23Jan2021 12:20, Avi Gross wrote: > >I am wondering how hard it would be to let some generators be resettable? > > > >I mean if you have a generator with initial conditions that change as it > >progresses, could it cache away those ini

Re: list() strange behaviour

2021-01-23 Thread Cameron Simpson
On 23Jan2021 12:20, Avi Gross wrote: >I am wondering how hard it would be to let some generators be resettable? > >I mean if you have a generator with initial conditions that change as it >progresses, could it cache away those initial conditions and upon some >signal, simply reset them? Objects of

RE: list() strange behaviour

2021-01-23 Thread Avi Gross via Python-list
I am wondering how hard it would be to let some generators be resettable? I mean if you have a generator with initial conditions that change as it progresses, could it cache away those initial conditions and upon some signal, simply reset them? Objects of many kinds can be set up with say a reinit

Re: list() strange behaviour

2021-01-23 Thread Terry Reedy
On 1/23/2021 2:54 AM, Unknown wrote: Le 20/12/2020 à 21:00, danilob a écrit : b = ((x[0] for x in a)) There is a useless pair of parenthesis b = (x[0] for x in a) b is a GENERATOR expression first list(b) calls next method on b repetedly until b is empty. So it provides the "content" of