[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

Zahash Z report at bugs.python.org
Wed Feb 20 11:52:38 EST 2019


Zahash Z <zahash.z at gmail.com> added the comment:

If you look at the queue.PriorityQueue class, there is self.queue = [ ].

That's because priority queue uses list data structure to implement the min
heap data structure (on which priority queue is based on).

So the list can be represented.
There is no need to remove anything.

On Wed, 20 Feb 2019, 10:17 pm Serhiy Storchaka, <report at bugs.python.org>
wrote:

>
> Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
>
> I guess you hurried to write the code. It has not yet been decided whether
> to expose the content of the queue in its repr at all. There is no public
> API for accessing the content of the queue without removing items from the
> queue, and I think it is intentional.
>
> What is your use case? Why you need to change the repr of queues?
>
> ----------
> nosy: +serhiy.storchaka
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <https://bugs.python.org/issue36049>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36049>
_______________________________________


More information about the Python-bugs-list mailing list