[Python-ideas] Yielding through context managers

Guido van Rossum guido at python.org
Sun Jan 6 17:24:07 CET 2013


On Sunday, January 6, 2013, Nick Coghlan wrote:

> On Sun, Jan 6, 2013 at 8:20 PM, Laurens Van Houtven <_ at lvh.cc> wrote:
> > Hi Nick,
> >
> >
> > When you say "high latency" (in __exit__), what does "high" mean? Is that
> > order of magnitude what __exit__ usually means now, or network IO
> included?
> >
> > (Use case: distributed locking and remotely stored locks: it doesn't
> take a
> > long time on network scales, but it can take a long time on CPU scales.)
>
> The status quo can only be made to work for in-memory locks. If the
> release step involves network access, then it's closer to the
> "database transaction" use case, because the __exit__ method may need
> to block.


But you don't need to wait for the release. You can do that asynchronously.

Also, have you given the implementation of your 'yielding' proposal any
thought yet?


>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com <javascript:;>   |   Brisbane,
> Australia
>


-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130106/f05b2d23/attachment.html>


More information about the Python-ideas mailing list