I have a function (Python 3):
import queue
q = queue.Queue()
q.put(1)
q.put(2)
q.put(3)
def printqueue(u):
while not u.empty():
print(u.get())
printqueue(q)
print(q.empty())
Why is q
empty at the end while I operated on u
? Is there a way to fix this?