New submission from Alan Iwi <[email protected]>:
It is possible to make `queue.Queue` and `queue.SimpleQueue` objects iterable
by adding simple `__iter__` and `__next__` methods. This is to suggest adding
these methods to the existing `Queue` and `SimpleQueue` so that they are
iterable by default.
```
class Fifo(SimpleQueue):
def __iter__(self):
return self
def __next__(self):
if not self.empty():
return self.get()
raise StopIteration
```
----------
components: Library (Lib)
messages: 373950
nosy: alaniwi
priority: normal
severity: normal
status: open
title: make queue.Queue objects iterable
type: enhancement
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41339>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com