Re: Iterator / Iteratable confusion

2005-02-16 Thread Michael Spencer
Adam DePrince wrote: How is a spencerator [an iterator that doesn't return itself unmodified on iter] > different than itertools.tee? Taking your question literally, it changes the behavior of an itertools.tee object 'tee', so that iter(tee) returns tee.__copy__(), rather than tee itself. It wa

Re: Iterator / Iteratable confusion

2005-02-16 Thread Michael Spencer
Terry Reedy wrote: "Michael Spencer" <[EMAIL PROTECTED]> wrote in message We are both interested in the murky edges at and beyond conventional usage. ... I am quite aware that multiple iterators for the same iterable (actual or conceptual) can be useful (cross products, for example). But I am d

Re: Iterator / Iteratable confusion

2005-02-15 Thread Adam DePrince
On Tue, 2005-02-15 at 19:25, Terry Reedy wrote: > "Michael Spencer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > Terry, thanks for responding in depth. > We are both interested in the murky edges at and beyond conventional usage. > > Terry wrote > >> 2. "It is not essential

Re: Iterator / Iteratable confusion

2005-02-15 Thread Terry Reedy
"Michael Spencer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry, thanks for responding in depth. We are both interested in the murky edges at and beyond conventional usage. > Terry wrote >> 2. "It is not essential to not do something wasteful as long as it is >> >> other

Re: Iterator / Iteratable confusion

2005-02-15 Thread Francis Girard
Le mardi 15 FÃvrier 2005 02:26, Terry Reedy a ÃcritÂ: > "Francis Girard" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > (Note for oldtimer nitpickers: except where relevant, I intentionally > ignore the old and now mostly obsolete pseudo-__getitem__-based iteration > protocol her

Re: Iterator / Iteratable confusion

2005-02-15 Thread Michael Spencer
Michael Spencer wrote: But, notwithstanding the docs, it is not essential that iter(iterator) is iterator Terry Reedy wrote: > iter(iterator) is iterator is part of the iterater protocol > [...]I interpret [your post] as saying three things: 1. "There is more than one possible definition of 'iterat

Re: Iterator / Iteratable confusion

2005-02-14 Thread Terry Reedy
"Michael Spencer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: >> iter(iterator) is iterator is part of the iterater protocol > But, notwithstanding the docs, it is not essential that > iter(iterator) is iterator If a program depends on that invariant, then i

Re: Iterator / Iteratable confusion

2005-02-14 Thread Terry Reedy
"Francis Girard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] (Note for oldtimer nitpickers: except where relevant, I intentionally ignore the old and now mostly obsolete pseudo-__getitem__-based iteration protocol here and in other posts.) Le dimanche 13 Février 2005 23:58, Te

Re: Iterator / Iteratable confusion

2005-02-14 Thread Scott David Daniels
Francis Girard wrote: Le dimanche 13 FÃvrier 2005 23:58, Terry Reedy a Ãcrit : Iterators are a subgroup of iterables. Being able to say iter(it) without having to worry about whether 'it' is just an iterable or already an iterator is one of the nice features of the new iteration design. I have dif

Re: Iterator / Iteratable confusion

2005-02-14 Thread Francis Girard
Le dimanche 13 FÃvrier 2005 23:58, Terry Reedy a ÃcritÂ: > Iterators are a subgroup of iterables. ÂBeing able to say iter(it) without > having to worry about whether 'it' is just an iterable or already an > iterator is one of the nice features of the new iteration design. > > Terry J. Reedy Hi, I

Re: Iterator / Iteratable confusion

2005-02-13 Thread Michael Spencer
"Francis Girard" <[EMAIL PROTECTED]> wrote in message an "iterator" doesn't have to support the "__iter__" method Terry Reedy wrote: Yes it does. iter(iterator) is iterator is part of the iterater protocol for the very reason you noticed... But, notwithstanding the docs, it is not essential t

Re: Iterator / Iteratable confusion

2005-02-13 Thread Michael Spencer
Francis Girard wrote: """ Example 8 Running after your tail with itertools.tee The beauty of it is that recursive running after their tai

Re: Iterator / Iteratable confusion

2005-02-13 Thread Terry Reedy
"Francis Girard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > An ""iteratable"" class is a class supporting the __iter__ method which > should > return an ""iterator"" instance, that is, an instance of a class > supporting > the "next" method. Not quite right, see below. > An