[issue35118] Add peek() or first() method in queue
Alexey Volkov added the comment: >Why not just dismiss older queue entries during a normal get() operation? Or >just use a plain deque with access guarded by a lock. You do not know whether the item needs to be removed until you see it. And to see it you need to get it. And if you get it, you cannot push it back to the start of the queue. >FWIW, the standard library queue module doesn't have a straight-forward way to >implement a peek() method. I currently use `q.deque[0]` >Or just use a plain deque with access guarded by a lock. I can. But technically the same applies to almost any queue usage. -- ___ Python tracker <https://bugs.python.org/issue35118> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12920] inspect.getsource only works for objects loaded from files, not interactive session
Alexey Volkov added the comment: This is also an issue even for non-interactive scenarios: When doing `python -c ''` inspect.getsource does not work and there are no stack traces. Perhaps this case will be easier to fix? -- nosy: +Ark-kun ___ Python tracker <https://bugs.python.org/issue12920> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35118] Add peek() or first() method in queue
Alexey Volkov added the comment: >For Queue, I'm not sure I've ever seen any use case for peek. What do you >have in mind? I want to examine the first (oldest) element in queue and remove it if it's too old. The queue should not be modified unless the oldest element is too old. -- nosy: +Ark-kun ___ Python tracker <https://bugs.python.org/issue35118> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com