bool evaluations of generators vs lists

Josh Dukes josh.dukes at microvu.com
Tue Feb 10 23:09:48 CET 2009


ahhh any! ok, yeah, I guess that's what I was looking for. Thanks.


On 10 Feb 2009 21:57:56 GMT
Steven D'Aprano <steven at REMOVE.THIS.cybersource.com.au> wrote:

> On Tue, 10 Feb 2009 12:50:02 -0800, Josh Dukes wrote:
> 
> > The thing I don't understand is why a generator that has no iterable
> > values is different from an empty list.
> 
> How do you know it has no iterable values until you call next() on it
> and get StopIteration?
> 
> By the way, your "has_values" function is just a slower version of
> the built-in any().
> 
> 


-- 

Josh Dukes
MicroVu IT Department



More information about the Python-list mailing list