你能解释一下双端队列的this构造函数吗:
import collections
buff = collections.deque([], 100)
我看到了它的文档,但找不到在任何地方使用此表单。
最佳答案
class collections.deque([iterable[, maxlen]])
Returns a new deque object initialized left-to-right (using append()) with data from iterable. If iterable is not specified, the new deque is empty.
在您的示例中,buff = collections.deque([], 100)
,
创建一个新的空双端队列对象 buff
,由第一个参数指定,maxlen 为 100。这意味着双端队列对象的最大长度为 100。
这是link对于文档,它解释得很好而且很清楚。
关于python - 集合双端队列构造函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37803574/