관리 메뉴

어읽로꾸거

[python] Queue.Queue vs collections.deque 본문

정리

[python] Queue.Queue vs collections.deque

어읽로꾸거 2019. 4. 22. 21:27

Queue.Queue and collections.deque serve different purposes. Queue.Queue is intended for allowing different threads to communicate using queued messages/data, whereas collections.deque is simply intended as a datastructure. That's why Queue.Queue has methods like put_nowait(), get_nowait(), and join(), whereas collections.deque doesn't. Queue.Queue isn't intended to be used as a collection, which is why it lacks the likes of the in operator.

 

그래서 큐보다 데큐가 더 빠른듯

 

https://stackoverflow.com/questions/717148/queue-queue-vs-collections-deque

 

Queue.Queue vs. collections.deque

I need a queue which multiple threads can put stuff into, and multiple threads may read from. Python has at least two queue classes, Queue.Queue and collections.deque, with the former seemingly us...

stackoverflow.com