"Guido van Rossum" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>> [Fred]
>> > think iterators shouldn't have length at all:
>> > they're *not* containers and shouldn't act that way.
>>
>> Some iterators can usefully report their length with the invariant:
>>len(it) == len(list
Jim Jewett wrote:
> "Is there anything left?" is a pretty analogy for iterators,
> particularly since the examples tend to start with list
> or file iterators.
But this can't be supported by all iterators, so it would
be something special to these iterators.
Keeping track of the peculiarities of
On 9/22/05, Jim Jewett <[EMAIL PROTECTED]> wrote:
> "Is there anything left?" is a pretty analogy for iterators,
But unmaintainable for iterators in general. This was considered ad
nauseam when iterators were initially introduced, and it was an
explicit decision *not* to provide an API to look ahe
Greg Ewing wrote:
> But if the docs don't mention anything about true or
> false values for some particular type, one tends to
> assume that all values are true, as is the default
> for user-defined classes.
The tutorials and such stress that python doesn't
typically care about a specific "True"
[Guido]
> I strongly feel that this needs to be corrected in 2.5. Iterators
> should have neither __len__ nor __nonzero__.
Right. I'll get it fixed-up.
[Terry Reedy]
> I presume there were two reasons: internal efficiency of
> preallocations
> (list(some_it) for example)
[Guido]
> This coul
On 9/21/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> [Guido van Rossum]
> > Could you at least admit that this was an oversight and not try to
> > pretend it was intentional breakage?
>
> Absolutely. I completely missed this one.
Thanks; spoken like a man.
I strongly feel that this needs t
Raymond Hettinger wrote:
> The Boolean value of an
> iterator is certainly not promised by the iterator protocol as specified
> in the docs or the PEP.
But if the docs don't mention anything about true or
false values for some particular type, one tends to
assume that all values are true, as is t
[Guido van Rossum]
> Could you at least admit that this was an oversight and not try to
> pretend it was intentional breakage?
Absolutely. I completely missed this one.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org
Guido van Rossum wrote:
> I just finished debugging some code that broke after upgrading to
> Python 2.4 (from 2.3). Turns out the code was testing list iterators
> for their boolean value (to distinguish them from None). In 2.3, a
> list iterator (like any iterator) is always true. In 2.4, an exha
On 9/20/05, Terry Reedy <[EMAIL PROTECTED]> wrote:
> I presume there were two reasons: internal efficiency of preallocations
> (list(some_it) for example)
This could have been implemented without making the implementation
details public.
> and letting people differentiate iterator with
> somethin
On 9/20/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> [Guido]
> > I just finished debugging some code that broke after upgrading to
> > Python 2.4 (from 2.3). Turns out the code was testing list iterators
> > for their boolean value (to distinguish them from None). In 2.3, a
> > list iterator
"Guido van Rossum" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>I just finished debugging some code that broke after upgrading to
> Python 2.4 (from 2.3). Turns out the code was testing list iterators
> for their boolean value (to distinguish them from None).
This seem unnecessar
[Guido]
> I just finished debugging some code that broke after upgrading to
> Python 2.4 (from 2.3). Turns out the code was testing list iterators
> for their boolean value (to distinguish them from None). In 2.3, a
> list iterator (like any iterator) is always true. In 2.4, an exhausted
> list ite
On 9/20/05, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote:
> In any case, it's simple to get the 2.3 behaviour back - just add
> __nonzero__. I think that could validly be considered a bugfix.
Alas not -- it would still be a functionality change relative to 2.4 and 2.4.1.
Also, an object whose
Fred L. Drake, Jr. wrote:
> On Tuesday 20 September 2005 17:49, Guido van Rossum wrote:
> > I realize that this was a deliberate feature, and that it exists in
> > 2.4 as well as in 2.4.1 and will in 2.4.2; yet, I'm not sure I
> *like*
>
> I wasn't paying any attention at the time, so I don't
On Tuesday 20 September 2005 17:49, Guido van Rossum wrote:
> I realize that this was a deliberate feature, and that it exists in
> 2.4 as well as in 2.4.1 and will in 2.4.2; yet, I'm not sure I *like*
I wasn't paying any attention at the time, so I don't know what was discussed.
Some discussi
I just finished debugging some code that broke after upgrading to
Python 2.4 (from 2.3). Turns out the code was testing list iterators
for their boolean value (to distinguish them from None). In 2.3, a
list iterator (like any iterator) is always true. In 2.4, an exhausted
list iterator is false; pr
17 matches
Mail list logo