Steven D'Aprano writes:
> > The two iterators have the same duck-type, the generator is different.
>
> How is the generator different?
My bad, I got the comparison backward. The generator *is* different,
but it's because the generator has *extra* public methods, not fewer.
Sorry for the noi
On Tue, Nov 28, 2017 at 04:25:23PM +, Rob Cliffe wrote:
> Given that we have this kind of arcane discussion fairly regularly (not
> just in this thread), and it always makes my head spin, and it seems I'm
> not the only one who gets confused:
>
> How about having a module that provides func
Given that we have this kind of arcane discussion fairly regularly (not
just in this thread), and it always makes my head spin, and it seems I'm
not the only one who gets confused:
How about having a module that provides functions such as
isgenerator isiterator isiterable etc.
or alter
On 28 November 2017 at 16:11, Stephen J. Turnbull
wrote:
> Steven D'Aprano writes:
>
> > The subset of iterators which are created as generators are *also*
> > called generators,
>
> As long as we're being precise, I don't think that is precisely correct:
>
> >>> (x for x in range(1))
>
On Tue, Nov 28, 2017 at 03:11:25PM +0900, Stephen J. Turnbull wrote:
> Steven D'Aprano writes:
>
> > The subset of iterators which are created as generators are *also*
> > called generators,
>
> As long as we're being precise, I don't think that is precisely correct:
>
> >>> (x for x in r
Steven D'Aprano writes:
> The subset of iterators which are created as generators are *also*
> called generators,
As long as we're being precise, I don't think that is precisely correct:
>>> (x for x in range(1))
at 0x10dee5e08>
>>> iter(range(1))
>>> iter((1,))
Th
On Mon, Nov 27, 2017 at 06:35:38PM +0200, Koos Zevenhoven wrote:
> SOLUTION: Maybe (a) all iterators should be called iterators
All iterators *are* called iterators. Just as all mammals are called
"mammals".
The subset of iterators which are created as generators are *also*
called generators,
On Mon, Nov 27, 2017 at 3:55 PM, Steven D'Aprano
wrote:
> On Mon, Nov 27, 2017 at 12:17:31PM +0300, Kirill Balunov wrote:
>
>
> > 2. Should this work only for generators or for any iterators?
>
> I don't understand why you are even considering singling out *only*
> generators. A generator is