<p>如果我使用的是python模块queue.queue,我希望能够使用不弹出原始队列或创建新队列对象的方法打印出内容。</p>
<p>我试过做一个获取,然后把内容放回去,但这是太高的成本。</p>
<pre><code># Ideally it would look like the following
from queue import Queue
q = Queue()
q.print()
q.put(1)
q.print()
>> [] # Or something like this
>> [1] # Or something like this
</code></pre>