Feb-06-2017, 08:20 AM
(Feb-06-2017, 05:18 AM)nilamo Wrote: Does that actually use coroutines anywhere, though? It just looks like generators to me.
numbers are sent to it, one at a time. numbers are received from it, one at a time. send it a None and it does nothing with it (yeah, not much different than send a 0 value). but this is using the send method. i personally don't like the asymmetry. but i don't see an easy way to make it symmetrical in python.
i do wonder about how python figures it to be a coroutine and blocks the initial call. i can envision code that can dynamically decide whether to do yield, or not, and accept sent data, or not. there is also the issue of using a proxy generator (a function to do the yield() and/or send() call for you). this stuff was complex enough in C.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.