Testing for empty iterators?

Roy Smith roy at panix.com
Sat Jul 3 20:11:02 CEST 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