Re: [Python-Dev] bool(iter([])) changed between 2.3 and 2.4
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 know what was discussed. Some discussion here just now leads me to believe that at least two of us here (including myself) think iterators shouldn't have length at all: they're *not* containers and shouldn't act that way.
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. Tim Delaney
On 9/20/05, Delaney, Timothy (Tim) <tdelaney@avaya.com> 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 __len__() returns 0 but whose __nonzero__() returns True would be an anomaly. The best we can do IMO is to change it back in 2.5. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (2)
-
Delaney, Timothy (Tim) -
Guido van Rossum