Re: [Tutor] generator object

2016-08-31 Thread Alan Gauld via Tutor
On 31/08/16 23:24, Alan Gauld via Tutor wrote: > Then I tried > ... > x = list(2) Should be list(gen(2)) I hope that was obvious... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.

Re: [Tutor] generator object

2016-08-31 Thread Peter Otten
Alan Gauld via Tutor wrote: > On 31/08/16 08:56, Alan Gauld via Tutor wrote: > >> A generator function can return any kind of object including >> basic types like numbers, bool etc.In addition, a generator >> function yields values which can also be of any type. > > Hmmm. > After reading Steven'

Re: [Tutor] generator object

2016-08-31 Thread Alan Gauld via Tutor
On 31/08/16 08:56, Alan Gauld via Tutor wrote: > A generator function can return any kind of object including > basic types like numbers, bool etc.In addition, a generator > function yields values which can also be of any type. Hmmm. After reading Steven's response I played around a bit. While a

Re: [Tutor] generator object

2016-08-31 Thread monik...@netzero.net
Aaron Maxwell made a clear distinction between generator function and that it returns a generator object. He emphasized that a couple of times. -- Original Message -- From: Alan Gauld via Tutor To: tutor@python.org Subject: Re: [Tutor] generator object Date: Wed, 31 Aug 2016 08

Re: [Tutor] generator object

2016-08-31 Thread monik...@netzero.net
Thank you everybody. This was very helpful Monika -- Original Message -- From: Steven D'Aprano To: tutor@python.org Subject: Re: [Tutor] generator object Date: Wed, 31 Aug 2016 21:24:57 +1000 On Wed, Aug 31, 2016 at 04:12:24AM +, monik...@netzero.net wrote: > > S

Re: [Tutor] generator object

2016-08-31 Thread Steven D'Aprano
On Wed, Aug 31, 2016 at 04:12:24AM +, monik...@netzero.net wrote: > > So generator function returns generator object according to Aaron > Maxwell. But does this mean that each time yields "returns" it is a > generator object? So if there are 5 yield "returns" there are 5 > generator objects

Re: [Tutor] generator object

2016-08-31 Thread Peter Otten
monik...@netzero.net wrote: > So generator function returns generator object according to Aaron Maxwell. It's always nice to give a link or a quote. > But does this mean that each time yields "returns" it is a generator > object? So if there are 5 yield "returns" there are 5 generator objects? >

Re: [Tutor] generator object

2016-08-31 Thread Alan Gauld via Tutor
On 31/08/16 05:12, monik...@netzero.net wrote: So generator function returns generator object according to Aaron Maxwell. I don't believe that's correct. A generator function can return any kind of object including basic types like numbers, bool etc.In addition, a generator function yields va