#!/home/songxinkai/anaconda3/bin/python
from collections import Iterator
from collections import Iterable
from datetime import datetime
def LIST(n):
    for i in range(n):
        yield i

if __name__ == "__main__":
    N = 10
    l = [x for x in range(N)]
    print ("Allocate list done.")
    # for x in l:
    #     print ("list: ", x)
    g = (x for x in range(N))
    print ("Allocate generator done.")
    # for x in g:
    #     print ("generator: ", x)
    L = LIST(N)
    print (L.__next__())
    print (next(L))
    l = list(L)
    print (len(l))
    print ("Allocate generator 2 done.")
    # for x in L:
    #     print ("generator 2: ", x)
    print (isinstance(l, Iterable))
    print (isinstance(g, Iterable))
    print (isinstance(L, Iterable))
    print (isinstance(iter(l), Iterable))

    print (isinstance(l, Iterator))
    print (isinstance(g, Iterator))
    print (isinstance(L, Iterator))
    print (isinstance(iter(l), Iterator))
    for i in range(1000000000):
        if i % 1000000 == 0:
            print (i, end="\r")
            print (i, end=" ")
    
