Is xrange not a generator? I know it doesn't return a tuple or list, so what exactly is it? Y doesn't ever complete, but x does.

x = (i for i in range(10))
y = xrange(10)

print "===X==="
while True:
    for i in x:
        print i
        break
    else:
        break

print "===Y==="
while True:
    for i in y:
        print i
        break
    else:
        break
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to