Functions like xrange are a bit "special" in being generator-like, but neither quite a real iterator (no.next method), nor a realized list like range returns.
xrange这样的函数与生成器类似的方面有些“特殊”,它们既不是真正的迭代器(没有.next方法),也不是实际的列表(比如range返回的列表)。
You can utilize the generator either manually or as an iterator.
可以手工或者作为迭代器来利用这个生成器。
Most frequently, however, you are likely to use a generator as an iterator, which is even more concise (and again looks just like an old-fashioned sequence).
然而,更多情况下,可能将生成器作为迭代器来使用,这样更为简练(并且看起来又象只是一个老式的序列)。
The only time an iterator would have a value itself is when you're implementing a generator that isn't actually associated with a container.
唯一的一次一个迭代器会本身的价值是当你实现一台发电机,实际上不与容器相关联。
The only time an iterator would have a value itself is when you're implementing a generator that isn't actually associated with a container.
唯一的一次一个迭代器会本身的价值是当你实现一台发电机,实际上不与容器相关联。
应用推荐