<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 9, 2013 at 8:31 AM, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Jan 8, 2013 at 5:14 PM, Yuriy Taraday <<a href="mailto:yorik.sar@gmail.com">yorik.sar@gmail.com</a>> wrote:<br>


> I've read the PEP and some things raise questions in my consciousness. Here<br>
> they are.<br>
<br>
</div>Thanks!<br>
<div class="im"><br>
> 1. Series of sock_ methods can be organized into a wrapper around sock<br>
> object. This wrappers can then be saved and used later in async-aware code.<br><br>
</div>This is a semi-internal API that is mostly useful to Transport<br>
implementers, and there won't be many of those. So I prefer the API<br>
that has the fewest classes.<br>
<div class="im"><br>
> 2. Not as great, but still possible to wrap fd in similar way to make<br>
> interface simpler.<br>
<br>
</div>Ditto.<br></blockquote><div><br></div><div style>Ok, I see.</div><div style>Should transports be bound to event loop on creation? I wonder, what would happen if someone changes current event loop between these calls.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> 3. Why not use properties (or fields) instead of methods for cancelled,<br>
> running and done in Future class? I think, it'll be easier to use since I<br>
> expect such attributes to be accessed as properties. I see it as some<br>
> javaism since in Java Future have getters for this fields but they are<br>
> prefixed with 'is'.<br>
<br>
</div>Too late, this is how PEP 3148 defined it. It was indeed inspired by<br>
Java Futures. However I would defend using methods here, since these<br>
are not all that cheap -- they have to acquire and release a lock.<br>
<div class="im"><br></div></blockquote><div><br></div><div style>I understand why it should be a method, but still if it's a getter, it should have either get_ or is_ prefix.</div><div style>Are there any way to change this with 'Final' PEP?</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
> 4. Why separate exception() from result() for Future class? It does the same<br>
> as result() but with different interface (return instead of raise). Doesn't<br>
> this violate the rule "There should be one obvious way to do it"?<br>
<br>
</div>Because it is quite awkward to check for an exception if you have to<br>
catch it (4 lines instead of 1).<br>
<div class="im"> <br></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
> 5. I think, protocol and transport methods' names are not easy or<br>
> understanding enough:<br>
> - write_eof() does not write anything but closes smth, should be<br>
> close_writing or smth alike;<br>
> - the same way eof_received() should become smth like receive_closed;<br>
<br>
</div>I am indeed struggling a bit with these names, but "writing an EOF" is<br>
actually how I think of this (maybe I am dating myself to the time of<br>
mag tapes though :-).<br>
<div class="im"><br></div></blockquote><div style>I never saw a computer working with a tape, but it's clear to me what does they do.</div><div style>I've just imagined the amount of words I'll have to say to students about EOFs instead of simple "it closes our end of one half of a socket".</div>

<div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
> - pause() and resume() work with reading only, so they should be suffixed<br>
> (prefixed) with read(ing), like pause_reading(), resume_reading().<br>
<br>
</div>Agreed.<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Kind regards, Yuriy.</div>
</div></div>