Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #86226
| Date | 2015-02-23 16:05 +0100 |
|---|---|
| From | Jonas Wielicki <jonas@wielicki.name> |
| Subject | Re: Question on asyncio |
| References | <52b94569-1480-4a05-a58f-13c2cb19229a@googlegroups.com> <8761atiqvt.fsf@elektro.pacujo.net> <5c9fa6a5-f92a-42a8-a760-9477f9d8d0d2@googlegroups.com> <87k2z8dagc.fsf@elektro.pacujo.net> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.19074.1424703937.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On 23.02.2015 14:27, Marko Rauhamaa wrote: > pfranken85@gmail.com: >> The corresponding call is a call to the python smbus library. It >> includes several sleeps (even though they are only about 50ms). >> Therefore I think it is worthwhile to encapsulate it into a coroutine. > > Maybe. Then you'll probably have to rewrite smbus to work asyncio style. > Those sleeps would then be done as "yield from" statements. > The manual has a word on this [1]. So I would suggest to use run_in_executor() instead of trashing and rewriting the whole smbus library. regards, jwi [1]: https://docs.python.org/3/library/asyncio-dev.html#handle-blocking-functions-correctly [2]: https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.BaseEventLoop.run_in_executor
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Question on asyncio pfranken85@gmail.com - 2015-02-22 09:47 -0800
Re: Question on asyncio Marko Rauhamaa <marko@pacujo.net> - 2015-02-22 23:21 +0200
Re: Question on asyncio pfranken85@gmail.com - 2015-02-23 01:48 -0800
Re: Question on asyncio Marko Rauhamaa <marko@pacujo.net> - 2015-02-23 15:27 +0200
Re: Question on asyncio Jonas Wielicki <jonas@wielicki.name> - 2015-02-23 16:05 +0100
Re: Question on asyncio Marko Rauhamaa <marko@pacujo.net> - 2015-02-23 18:30 +0200
csiph-web