On Thu, 27 Mar 2008 00:33:21 -0700, Grimsqueaker wrote:

> That seems to give me the items in the list back in an iterator. Am I
> using it incorrectly?

Given an iterator, you use it like this:

for item in iterator:
    print item # or do something else


If you're sure that the iterator is relatively small, you can do this:

give_me_everything_at_once = list(iterator)


but don't try that with this one:


def ones():  # never-ending series of ones
    while True:
        yield 1

iterator = ones()


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to