I am practicing doing programming competitions using python(actually pypy3). For a problem I need to use a queue - I only need to put at one end and pop from the other. From what I found in the documentation it seems I have two options queue.Queue
and queue.deque
. I first tried the problem using queue.Queue, but my solution exceeded the time limit. Then I switched to queue.deque
and I passed the problem(though close to the limit).
From the documentation it seems both containers are thread safe(well at least for some operations for deque) while for my situation I will never use more than one thread. Is there a simple non-synchronized queue built-in in python?