Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c09e6b1

Browse files
committed
Clarify that put *blocks* when the queue is full. Add some blank
lines to doc strings.
1 parent 363ab1a commit c09e6b1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/Queue.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ def full(self):
4444
return n
4545

4646
def put(self, item):
47-
"""Put an item into the queue."""
47+
"""Put an item into the queue.
48+
49+
If the queue is full, block until a free slot is avaiable.
50+
"""
4851
self.fsema.acquire_lock()
4952
self.mutex.acquire_lock()
5053
was_empty = self._empty()
@@ -57,6 +60,7 @@ def put(self, item):
5760

5861
def get(self):
5962
"""Gets and returns an item from the queue.
63+
6064
This method blocks if necessary until an item is available.
6165
"""
6266
self.esema.acquire_lock()
@@ -74,6 +78,7 @@ def get(self):
7478
# raise Empty if the queue is empty or temporarily unavailable
7579
def get_nowait(self):
7680
"""Gets and returns an item from the queue.
81+
7782
Only gets an item if one is immediately available, Otherwise
7883
this raises the Empty exception if the queue is empty or
7984
temporarily unavailable.

0 commit comments

Comments
 (0)