Re: How the heck does async/await work in Python 3.5

2016-02-23 Thread Sven R. Kunze
On 20.02.2016 07:53, Christian Gollwitzer wrote: If you have difficulties wit hthe overall concept, and if you are open to discussions in another language, take a look at this video: https://channel9.msdn.com/Shows/C9-GoingNative/GoingNative-39-await-co-routines MS has added coroutine

Re: How the heck does async/await work in Python 3.5

2016-02-23 Thread Sven R. Kunze
On 23.02.2016 18:37, Ian Kelly wrote: It's not entirely clear to me what the C++ is actually doing. With Python we have an explicit event loop that has to be started to manage resuming the coroutines. Since it's explicit, you could easily drop in a different event loop, such as Tornado or curio,

Re: How the heck does async/await work in Python 3.5

2016-02-23 Thread Ian Kelly
On Tue, Feb 23, 2016 at 9:50 AM, Sven R. Kunze wrote: > On 23.02.2016 01:48, Ian Kelly wrote: >> >> On Mon, Feb 22, 2016 at 3:16 PM, Sven R. Kunze wrote: >>> >>> Is something like shown in 12:50 ( cout << tcp_reader(1000).get() ) >>> possible >>> with asyncio?

Re: How the heck does async/await work in Python 3.5

2016-02-23 Thread Sven R. Kunze
On 23.02.2016 01:48, Ian Kelly wrote: On Mon, Feb 22, 2016 at 3:16 PM, Sven R. Kunze wrote: Is something like shown in 12:50 ( cout << tcp_reader(1000).get() ) possible with asyncio? (tcp_reader would be async def) loop = asyncio.get_event_loop()

Re: How the heck does async/await work in Python 3.5

2016-02-22 Thread Ian Kelly
On Mon, Feb 22, 2016 at 3:16 PM, Sven R. Kunze wrote: > Is something like shown in 12:50 ( cout << tcp_reader(1000).get() ) possible > with asyncio? (tcp_reader would be async def) loop = asyncio.get_event_loop() print(loop.run_until_complete(tcp_reader(1000))) --

Re: How the heck does async/await work in Python 3.5

2016-02-22 Thread Sven R. Kunze
On 20.02.2016 07:53, Christian Gollwitzer wrote: If you have difficulties wit hthe overall concept, and if you are open to discussions in another language, take a look at this video: https://channel9.msdn.com/Shows/C9-GoingNative/GoingNative-39-await-co-routines MS has added coroutine

Re: How the heck does async/await work in Python 3.5

2016-02-20 Thread Paul Rubin
Steven D'Aprano writes: > "But frankly the stuff I'm seeing in this thread makes me sad for > *literally every programming language in existence except for Erlang > and maybe one or two others*, which altogether about six people use in > total..." Erlang microtasks are more

Re: How the heck does async/await work in Python 3.5

2016-02-20 Thread Steven D'Aprano
On Sat, 20 Feb 2016 05:44 pm, Paul Rubin wrote: > But frankly the stuff I'm seeing in this thread makes me sad for Python. > It's an impossible dream but it would be awesome to have Erlang-like > communicating microtasks in Python. "But frankly the stuff I'm seeing in this thread makes me sad

Re: How the heck does async/await work in Python 3.5

2016-02-20 Thread Ian Kelly
On Sat, Feb 20, 2016 at 1:49 AM, Chris Angelico wrote: > Actually, that mightn't be a bad thing. Maybe raise that as a tracker > issue? I just tested, and slapping "from __future__ import > generator_stop" at the top of Lib/asyncio/futures.py causes your > example to raise an

Re: How the heck does async/await work in Python 3.5

2016-02-20 Thread Ian Kelly
On Sat, Feb 20, 2016 at 1:49 AM, Chris Angelico wrote: > Definitely seems like it should be fixed, then; the current behaviour > is that Future.result() raises RuntimeError if you raise > StopIteration, so having await do the same would make sense. Future.result() itself simply

Re: How the heck does async/await work in Python 3.5

2016-02-20 Thread Chris Angelico
On Sat, Feb 20, 2016 at 7:14 PM, Ian Kelly wrote: > On Sat, Feb 20, 2016 at 12:57 AM, Chris Angelico wrote: >> On Sat, Feb 20, 2016 at 6:48 PM, Ian Kelly wrote: >>> As another point that happens to be fresh in my mind, awaiting a

Re: How the heck does async/await work in Python 3.5

2016-02-20 Thread Ian Kelly
On Sat, Feb 20, 2016 at 12:57 AM, Chris Angelico wrote: > On Sat, Feb 20, 2016 at 6:48 PM, Ian Kelly wrote: >> As another point that happens to be fresh in my mind, awaiting a >> Future on which an exception gets set is supposed to propagate the >>

Re: How the heck does async/await work in Python 3.5

2016-02-20 Thread Chris Angelico
On Sat, Feb 20, 2016 at 6:48 PM, Ian Kelly wrote: > As another point that happens to be fresh in my mind, awaiting a > Future on which an exception gets set is supposed to propagate the > exception. I recently found that this breaks if the exception in > question happens to

Re: How the heck does async/await work in Python 3.5

2016-02-19 Thread Ian Kelly
On Fri, Feb 19, 2016 at 10:24 PM, Rustom Mody wrote: > Less snarkily looks like a series of bolt-ons after bolt-ons > > IMHO Guido's (otherwise) uncannily sound intuitions have been wrong right from > 2001 when he overloaded def for generators. > And after that its been

Re: How the heck does async/await work in Python 3.5

2016-02-19 Thread Christian Gollwitzer
Am 20.02.16 um 03:36 schrieb Steven D'Aprano: On Thu, 18 Feb 2016 09:08 am, Mark Lawrence wrote: Seeing there is a lot of interest in asyncio recently I figured people might be interested in this http://www.snarky.ca/how-the-heck-does-async-await-work-in-python-3-5 Thanks for the link, but

Re: How the heck does async/await work in Python 3.5

2016-02-19 Thread Paul Rubin
Rustom Mody writes: > Forgot the probably most important: Not merging stackless into CPython I thought there was some serious technical obstacle to that. Where can I find Greg Ewing's suggestions about Python coroutines? The async/await stuff seems ok on the surface. I

Re: How the heck does async/await work in Python 3.5

2016-02-19 Thread Rustom Mody
On Saturday, February 20, 2016 at 10:55:02 AM UTC+5:30, Rustom Mody wrote: > On Saturday, February 20, 2016 at 8:07:03 AM UTC+5:30, Steven D'Aprano wrote: > > On Thu, 18 Feb 2016 09:08 am, Mark Lawrence wrote: > > > > > Seeing there is a lot of interest in asyncio recently I figured people > > >

Re: How the heck does async/await work in Python 3.5

2016-02-19 Thread Rustom Mody
On Saturday, February 20, 2016 at 8:07:03 AM UTC+5:30, Steven D'Aprano wrote: > On Thu, 18 Feb 2016 09:08 am, Mark Lawrence wrote: > > > Seeing there is a lot of interest in asyncio recently I figured people > > might be interested in this > >

Re: How the heck does async/await work in Python 3.5

2016-02-19 Thread Steven D'Aprano
On Thu, 18 Feb 2016 09:08 am, Mark Lawrence wrote: > Seeing there is a lot of interest in asyncio recently I figured people > might be interested in this > http://www.snarky.ca/how-the-heck-does-async-await-work-in-python-3-5 Thanks for the link, but I'm now no wiser than I was before :-( Can