pyton_iterator_learning
# author: Roy.G
# from collections import iterable
from collections.abc import Iterable,Iterator
a=[1,2,3]
print(isinstance(a,Iterable)) #determine if a subject is iterable
print(isinstance("abc",Iterable))
print(isinstance("abc",Iterator))
print("generator==>",isinstance((x for x in range(3)),Iterator))
print("list==>",isinstance([x for x in range(3)],Iterator))
print([x for x in range(3)],type([x for x in range(3)]))
print((x for x in range(3)),type((x for x in range(3))))
b=iter(a)
print("a==>",isinstance(b,Iterator)) # iner change a list to a iterator
print("----b.next----\n")
print(str(b.__next__()).strip())
print(b.__next__())
print(b.__next__())