一个迭代器 - 翻译成英语

在 中文 中使用 一个迭代器 的示例及其翻译为 英语

{-}
  • Political category close
  • Ecclesiastic category close
  • Programming category close
集合拥有4种基本操作(下面的调用全部都返回一个迭代器):.
Sets have 4 primary operations(all of the following calls return an iterator).
因为'it'是一个迭代器了,我们需要'it'中取出一个对象进行操作。
Since‘it' is an iterator, we need to take an object from‘it' before operating.
因此,生成器看起来像一个函数但是表现的却像一个迭代器.
In short, a generator looks like a function but behaves like an iterator.
由于‘it'是一个迭代器,所以我们必须在运算前从‘it'得到对象。
Since‘it' is an iterator, we need to take an object from‘it' before operating.
普通对象通常不能迭代,除非你已经为它定义了一个迭代器(Iterator)。
Plain objects can't normally be iterated over, unless you have defined an iterator for it.
表达式'[iters(inputs)]*n'创建一个迭代器对象,它包含了n个同样的列表对象。
The expression[iters(inputs)]* n creates a list of n references to the same iterator.
执行Generator函数会返回一个迭代器对象,而不是执行它的函数体内容。
Calling a generator function makes it return a generator object rather than executing the body of the function.
在字典上调用iter()会返回一个迭代器,这个迭代器会遍历字典中的所有键:.
Calling lter() on a dictionary returns an iterator that will loop over the dictionary's keys.
Filter()函数返回一个迭代器,该迭代器通过一个函数对项目进行过滤以测试该项目是否被接受。
The filter() function returns an iterator where the items are filtered through a function to test if the item is accepted or not.
首先,有时候你必须返回一个非常复杂的类型,比如在对标准库容器进行搜索的时候返回一个迭代器
First, there are times when you need to return a fairly complex type, such as an iterator, perhaps when searching into a standard library container.
例如,示例13-13中的代码通过调用定义于Vec上的iter方法在一个vectorv1上创建了一个迭代器
For example, the code in Listing 13-13 creates an iterator over the items in the vector v1 by calling the iter method defined on Vec.
这段代码使用了‘it'的命名,显示了该变量是如何实现的(使用了一个迭代器),而不是该变量的含义。
This code uses the name‘it', reflecting how this variable is implemented(with an iterator), rather than what the variable means.
在我们的示例中,0…10是一个表达式,说明了开始和结束的位置,并给出一个迭代器遍历在这些值。
In our example, 0… 10 is an expression that takes a start and an end position, and gives an iterator over those values.
序列的解压操作也支持迭代器:如果你知道一个迭代器能够返回N个元素,你可以把他们解压到有N个元素的元组.
Sequence unpacking also supports iterators: if you know an iterator will return N elements, you can unpack them into an N-tuple.
Consumer操作一个迭代器,返回某些类型的值。
A consumer operates on an iterator, returning some kind of value or values.
消费者使用一个迭代器,产生一些值最后的设置。
Consumers operate on an iterator, producing some final set of values.
做到这一点最简单的方法是采用一个迭代器,它是一个对象,实现了Iterator接口或ListIterator接口。
The easiest way to do this is to employ an iterator, which is an object that implements either the Iterator or the ListIterator interface.
TcpListener的incoming方法返回一个迭代器,它提供了一系列的流(更准确的说是TcpStream类型的流)。
The incoming method on TcpListener returns an iterator that gives us a sequence of streams(more specifically, streams of type TcpStream).
让我们来看看一个迭代器实现在实践中看起来是什么样的。
Let's see what an iterator implementation looks like in practice.
做到这一点最简单的方法是采用一个迭代器,它是一个对象,实现了Iterator接口或ListIterator接口。
The better way is to employ an iterator, which is an object that implements either the Iterator or the ListIterator interface.
结果: 154, 时间: 0.0201

单词翻译

顶级字典查询

中文 - 英语