python迭代器、生成器、yield和xrange

1,迭代器: 支持next和__iter__方法的类,python 其中next须要抛出StopIteration异常或返回迭代值,闭包 __iter__须要返回迭代器本身,app 也能够实现send函数,但要保证send函数调用next。dom class MyIterator(object): def __init__(self, step): self.step = s
相关文章
相关标签/搜索