Testing for empty iterators?

Roy Smith roy at panix.com
Sat Jul 3 14:11:02 EDT 2004


I wrote:

> flag = False
> for thing in getThingIterator ():
>    flag = True
>    break
> assertEquals (flag, False)
> 
> Is that really the only way to do it?

Oh, never mind, I got it...

assertEquals (list (getThingIterator ()), [])



More information about the Python-list mailing list