[Python-Dev] Iterating over objects of unknown length

Oleg Broytmann phd at phd.pp.ru
Wed Sep 26 18:37:28 CEST 2007


On Wed, Sep 26, 2007 at 09:29:10AM -0700, Guido van Rossum wrote:
> But I also fail to see why you would be so draconian as to disallow
> truth testing of a query altogether. Your query looks like an
> iterator. There are tons of other iterators in the language, library
> and 3rd party code, and it would be madness to try to fix all of them
> in the way you suggest just because some users don't get the concept
> of iterators.

   Seems me myself didn't get it:

On Wed, Sep 26, 2007 at 12:33:33PM -0400, Phillip J. Eby wrote:
> This isn't consistent with iterators; e.g.:
> 
> >>> x=iter([])
> >>> if x: print "yes"
> ...
> yes

On Wed, Sep 26, 2007 at 09:29:10AM -0700, Guido van Rossum wrote:
> So I'm for #1 *and* #2.

   I see now. Thank you!

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-Dev mailing list