<div class="gmail_quote">Do you use gevent's monkeypatch-the-stdlib feature?<br><br>On Tue, Oct 16, 2012 at 8:40 PM, Matthias Urlichs <span dir="ltr"><<a href="mailto:matthias@urlichs.de" target="_blank">matthias@urlichs.de</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'll have to put in my ..02€ here …<br>
<div class="im"><br>
Guido van Rossum <guido@...> writes:<br>
<br>
> (2) We're at a fork in the road here. On the one hand, we could choose<br>
> to deeply integrate greenlets/gevents into the standard library.<br>
<br>
</div>Yes.<br>
<br>
I have two and a half reasons for this.<br>
<br>
(½) Ultimately I think that switching stacks around is always going to be faster<br>
than unwinding and re-winding things with yield().<br></blockquote><div><br>That seems like something that can be factually proven or counterproven.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


(1) It's a whole lot easier to debug a problem with gevent than with anything<br>
which uses yield / Deferreds / asyncore / whatever. With gevent, you get a<br>
standard stack trace. With anything else, the "where did this call come from"<br>
information is not part of the call chain and thus is either unavailable, or<br>
will have to be carried around preemptively (with associated overhead).<br></blockquote><div><br>gevent uses stack slicing, which IIUC is pretty expensive. Why is it not subject to the performance overhead you mention?<br>

<br>Can you give an example of such a crappy stack trace in twisted? I 
develop in it all day, and get pretty decent stack traces. The closest 
thing I have to a crappy stack trace is when doing functional tests with
 an RPC API -- obviously on the client side all I'm going to see is a 
fairly crappy just-an-exception. That's okay, I also get the server side
 exception that looks like a plain old Python traceback to me and tells 
me exactly where the problem is from. </div><div><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">(2) Nothing against Twisted or any other async frameworks, but writing any<br>


nontrivial program in it requires warping my brain into something that's *not*<br>
second nature in Python, and never going to be.<br></blockquote><div><br>Which ones are you thinking about other than twisted? It seems that the issue you are describing is one of semantics, not so much of whether or not it actually does things asynchronously under the hood, as e.g gevent does too.<br>

 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Python is not Javascript; if you want to use the "loads of callbacks"<br>
programming style, use node.js.<br></blockquote><div><br>None of the solutions on the table have node.js-style "loads of callbacks". Everything has some way of structuring them. It's either implicit switches (as in "can happen in the caller"), explicit switches (as in yield/yield from) or something like deferreds, some options having both of the latter.<br>

 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Personal experience: I have written an interpreter for an asynchronous and<br>
vaguely Pythonic language which I use for home automation, my lawn sprinkers,<br>
and related stuff (which I should probably release in some form). The code was<br>
previously based on Twisted and was impossible to debug. It now uses gevent and<br>
Just Works.<br></blockquote><div><br>If you have undebuggable code samples from that I'd love to take a look.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<span class="HOEnZb"><font color="#888888"><br>
--<br>
-- Matthias Urlichs<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>cheers<div>lvh</div><br>