Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75126
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Marko Rauhamaa <marko@pacujo.net> |
| Newsgroups | comp.lang.python |
| Subject | Re: Question about asyncio doc example |
| Date | Thu, 24 Jul 2014 08:54:07 +0300 |
| Organization | A noiseless patient Spider |
| Lines | 18 |
| Message-ID | <87d2cvti80.fsf@elektro.pacujo.net> (permalink) |
| References | <CAO3PiBgEsjvWMMqZkkOUoHmyDQr4=BtprspHj1kw7itOMiZDpw@mail.gmail.com> <lqpjnu$dun$1@ger.gmane.org> <mailman.12265.1406179417.18130.python-list@python.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="22583"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//3JqwuBvDDrgIuG1FT/MH" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
| Cancel-Lock | sha1:vB4T0VZUwB5WG1Q+T3+E+jEYXlY= sha1:NeevsMU/JEI1UYwbeUL0POcycQA= |
| Xref | csiph.com comp.lang.python:75126 |
Show key headers only | View raw
Saimadhav Heblikar <saimadhavheblikar@gmail.com>: > For situations where I dont really know how long a function is going > to take(say waiting for user input or a network operation), I am > better off using callbacks than "yield from asyncio.sleep()". Is my > understanding correct? If you choose the coroutine style of programming, you wouldn't normally use callbacks. Instead, you would "yield from" any blocking event. There are coroutine equivalents for locking, network I/O, multiplexing etc. The callback style encodes the state in a variable. The coroutine style (which closely resembles multithreading), encodes the state in the code itself. Both styles can easily become really messy (because reality is surprisingly messy). Marko
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Question about asyncio doc example Saimadhav Heblikar <saimadhavheblikar@gmail.com> - 2014-07-24 10:45 +0530 Re: Question about asyncio doc example Marko Rauhamaa <marko@pacujo.net> - 2014-07-24 08:54 +0300
csiph-web