A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-June/140493.html below:

[Python-Dev] Obtaining stack-frames from co-routine objects

[Python-Dev] Obtaining stack-frames from co-routine objects [Python-Dev] Obtaining stack-frames from co-routine objectsMRAB python at mrabarnett.plus.com
Sat Jun 13 21:01:57 CEST 2015
On 2015-06-13 11:38, jaivish kothari wrote:
> Hi ,
>
>     I had a Question,i hope i'll find the solution here.
>
> Say i have a Queue.
>   >>> h = Queue.Queue(maxsize=0)
>  >>> h.put(1)
>  >>> h.put(2)
>  >>> h.empty()
> False
>  >>> h.join()
>  >>> h.empty()
> False
>  >>> h.get()
> 1
>  >>> h.get()
> 2
>  >>> h.get()
> Blocked.......................
>
> My Question is :
> In a single threaded environment why does the get() gets blocked ,
> instead of raising an exception.On interpreter i have no way to resume
> working.
>
> And my second question is :
> Why doe we have to explicitly call task_done after get(). why doesn't
> get() implicitly call task_done().
> as for put() entry for unfinished_task is automatically added .why not
> get deleted in get() then.
>
The way it's used is to get a item, process it, and then signal that it
has finished with it. There's going to be a period of time when an item
is not in the queue, but is still being processed.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4