标签: python python-3.x iterator generator
#Generator gen=(x for x in [1,2,3]) #Iterator it = iter([1,2,3]) #Both can be it iterated over: for i in gen: print i for i in it: print i
那么,有什么区别?理论上和实践上都一样?我应该使用哪个版本?