<div dir="ltr"><br><br><div class="gmail_quote">On Tue, May 5, 2015 at 3:14 PM Paul Moore <<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 5 May 2015 at 19:25, Yury Selivanov <<a href="mailto:yselivanov.ml@gmail.com" target="_blank">yselivanov.ml@gmail.com</a>> wrote:<br>
> On 2015-05-05 7:27 AM, Wolfgang wrote:<br>
>> Even the discussion on python-dev suggests there is some time needed<br>
>> to finalize all this.<br>
><br>
> I'd say that:<br>
><br>
> 80% of the recent discussion of the PEP is about terminology.<br>
> 10% is about whether we should have __future__ import or not.<br>
<br>
But the terminology discussion appears to revolve around people<br>
finding the various concepts involved in asyncio (particularly the new<br>
PEP, but also to an extent the existing implementation) confusing. I<br>
can confirm, having tried to work through the asyncio docs, that the<br>
underlying concepts and how they are explained, are confusing to an<br>
outsider.<br>
<br>
That's not to say that everything needs to be beginner-friendly, but<br>
it *does* mean that it's hard for the wider Python community to<br>
meaningfully comment, or evaluate or sanity-check the design. We're<br>
left with a sense of "trust us, it makes sense if you need it,<br>
everyone else can ignore it".<br></blockquote><div><br></div><div>Watch David Beazley's talk from PyCon this year and you can watch him basically re-implement asyncio on stage in under 45 minutes. It's not as complicated as it seems when you realize there is an event loop driving everything (which people have been leaving out of the conversation since it doesn't tie into the syntax directly).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Personally, I feel as if PEP 492 is looking a little premature - maybe<br>
the focus should be on making asyncio more accessible first, and<br>
*then* adding syntax.</blockquote><div><br></div><div>I think this ties the concept of adding syntax to Python to make coroutine-based programming easier too much to asyncio; the latter is just an implementation of the former. This PEP doesn't require asyncio beyond the fact that will be what provides the initial event loop in the stdlib.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> You can argue that the syntax is needed to help<br>
make async more accessible - but if that's the case then the<br>
terminology debates and confusion are clear evidence that it's not<br>
succeeding in that goal.</blockquote><div><br></div><div>Perhaps, but arguing about the nitty-gritty details of something doesn't automatically lead to a clearer understanding of the higher level concept. Discussing how turning a steering wheel in a car might help you grasp how cars turn, but it isn't a requirement to get "turn the wheel left to make the car go left".</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Of course, that's based on my perception of<br>
one of the goals of the PEP as being "make coroutines and asyncio more<br>
accessible", If the actual goals are different, my conclusion is<br>
invalid.<br></blockquote><div><br></div><div>I think the goal is "make coroutines easier to use" and does not directly relate to asyncio.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
>> We forget to address the major problems here. How can someone in a<br>
>> "sync" script use this async stuff easy. How can async and sync stuff<br>
>> cooperate and we don't need to rewrite the world for async stuff.<br>
>> How can a normal user access the power of async stuff without rewriting<br>
>> all his code. So he can use a simple asyc request library in his code.<br>
>> How can a normal user learn and use all this in an easy way.<br>
><br>
> asyncio and twisted answered these questions ;) The answer is<br>
> that you have to write async implementations.<br>
<br>
Well, twisted always had defer_to_thread. Asyncio has run_in_executor,<br>
but that seems to be callback-based rather than coroutine-based?<br></blockquote><div><br></div><div>Yep.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Many people use requests for their web access. There are good reasons<br>
for this. Are you saying that until someone steps up and writes an<br>
async implementation of requests, I have to make a choice - requests<br>
or asyncio?</blockquote><div> </div><div>I believe so; you need something to implement __await__. This is true in any language that implements co-routines.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Unfortunately, I can't see myself choosing asyncio in that<br>
situation. Which again means that asyncio becomes "something that the<br>
average user can't use". Which in turn further entrenches it as a<br>
specialist-only tool.<br></blockquote><div><br></div><div>You forgot to append "... yet" to that statement. Just because something isn't available out of the box without some effort to support doesn't mean it will never happen, else there would be absolutely no Python 3 users out there.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
As another example, in Twisted I could use defer_to_thread to<br>
integrate Oracle database access into a twisted application (that's<br>
what the twisted database stuff did under the hood). Can I do that<br>
with asyncio? Will the syntax in the PEP help, hinder or be irrelevant<br>
to that?<br>
<br>
>> And for all this we still can't tell them "oh the async stuff solves<br>
>> the multiprocessing problem of Python learn it and switch to version<br>
>> 3.5". It does not and it is only most useful for networking stuff<br>
>> nothing more.<br>
><br>
> "networking stuff", and in particular, web, is a huge<br>
> part of current Python usage.  Please don't underestimate<br>
> that.<br>
<br>
Without async versions of requests and similar, how much of a chunk of<br>
the networking/web area will asyncio take? (Genuine question, I have<br>
no idea). And how much extra will this PEP add? Those may not be fair<br>
questions (and even if they are fair, the answers are probably<br>
unknowable), but as an outsider, I feel only the costs of the asyncio<br>
implementation (a new library that I don't understand, and now a<br>
relatively large amount of new syntax and special methods I have to<br>
ignore because they don't make sense to me). That's OK, but I think I<br>
am being reasonable to ask for some sense of the level of benefits<br>
others are getting to balance out the costs I incur.<br></blockquote><div><br></div><div>Co-routine-based asynchronous programming is new to Python, so as a community we don't have it as something everyone learns over time. If you don't come from an area that supports it then it will be foreign to you and not make sense without someone giving you a good tutorial on it. But considering C#, Dart, and Ecmascript 6 (will) have co-routine support -- and those are just the languages I can name off the top of my head -- using the exact same keywords suggests to me that it isn't *that* difficult of a topic to teach people. This is just one of those PEPs where you have to trust the people with experience in the area are making good design decisions for those of us who aren't in a position to contribute directly without more experience in the domain.</div><div><br></div><div>-Brett</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Paul<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/brett%40python.org" target="_blank">https://mail.python.org/mailman/options/python-dev/brett%40python.org</a><br>
</blockquote></div></div>