Search code examples
pythonstringqueuerepr

Why doesn't the python Queue class have a __repr__ or __str__ defined?


I'm trying to print a multiprocessing queue and I only get the memory address of the object. Can someone please tell me why the devs decided not to implement the functionality?


Solution

  • Were you expecting to see the elements? Doing that would require removing all elements from the queue due to how the inter-process communication works, and the results wouldn't necessarily be "what's in the queue right now" with other processes pushing and popping elements concurrently.