[Tutor] asyncio or threading

Alan Gauld alan.gauld at btinternet.com
Sun Feb 28 04:07:44 EST 2016


On 28/02/16 07:24, Zachary Ware wrote:

>> (Not that I've seen too many examples, but the ones I have seen
>> all used callbacks.)
> 
> Could you point me towards some of those examples?

As my followup post said they did actually mention coroutines
as well, I just didn't pick up on it at the time.

I suspect that's because call backs are in my programming DNA
since it's how most of my early C programming on embedded and
real time systems worked. So I saw async and callbacks and
thought "I've come home" :-)

> measure of salt :).  My impression was that the callback style
> naturally leads to doing things where callbacks are chained several
> layers deep, which makes things hard to read and takes concentrated
> effort (slight though it may be) to avoid.

It isn't hard to read if laid out sensibly, and you can define
separate functions for each call back rather than defining
them inline. But inline functions have their own style that
is no harder to read than, say, multi layer if/else statements
once you get used to them.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list