<p>It seems</p>

<pre><code>import Queue

Queue.Queue().get(timeout=10)
</code></pre>

<p>is keyboard interruptible (ctrl-c) whereas</p>

<pre><code>import Queue

Queue.Queue().get()
</code></pre>

<p>is not. I could always create a loop;</p>

<pre><code>import Queue
q = Queue()

while True:
    try:
        q.get(timeout=1000)
    except Queue.Empty:
        pass
</code></pre>

<p>but this seems like a strange thing to do.</p>

<p>So, is there a way of getting an indefinitely waiting but keyboard interruptible Queue.get()?</p>

```
Queue
```
objects have this behavior because they lock using
```
Condition
```
objects form the
```
threading
```
module.  So your solution is really the only way to go.
However, if you really want a
```
Queue
```
method that does this, you can monkeypatch the
```
Queue
```
class.  For example:
```
```
def interruptable_get(self):
    while True:
        try:
            return self.get(timeout=1000)
        except Queue.Empty:
            pass
Queue.interruptable_get = interruptable_get
```
```
This would let you say
```
```
q.interruptable_get()
```
```
instead of
```
```
interruptable_get(q)
```
```
although monkeypatching is generally discouraged by the Python community in cases such as these, since a regular function seems just as good.