Path: csiph.com!usenet.pasdenom.info!aioe.org!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(even': 0.05; 'subject:Question': 0.07; '[1]:': 0.09; '[2]:': 0.09; 'rewrite': 0.09; 'style.': 0.09; 'python': 0.11; 'suggest': 0.14; '[1].': 0.16; 'filename:fname piece:signature': 0.16; 'received:78.47': 0.16; 'rewriting': 0.16; 'wrote:': 0.18; 'manual': 0.22; 'header :User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'probably': 0.32; 'url:python': 0.33; 'library.': 0.36; 'done': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'url:3': 0.61; "you'll": 0.62; 'therefore': 0.72 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wielicki.name; s=k001.sol; t=1424703929; bh=2qrb6NjjTTFjFmcQ1bKPnyAwUB67qDlDV7HEaeeOJmM=; h=Date:From:To:Subject:References:In-Reply-To; b=oXLwkhc5JMVGIFsFlJgvsQzcNWWgTs7mvmlw4MwzMH2YwxjRwpV51OH9PNN998Zxh sNcP6kVboT74oUTp28GWh8sazoF/G6JpgdMXcRq0Rb2GpO7FtinYBZQ0KuDIuS1ikZ FHxV0pTLhCIIdyEa9iCRzjvLmUcNOecVey4uTGdy7VvmRJ/e9KQWuxJlRLbPZdoT9f FFsal1dJk2zVsL9doVjLHQqzmEFiLqVYPcPzB45c91R/qkTUteRWeQUEdEd+QMt6F4 IfYrOMHCNcVDEY7MS++mzPc0O71mXrV/a8mHMDY6dy3QvuqpNNvOWqcTklNkejQepB sU72me+gA3Q0Q== Date: Mon, 23 Feb 2015 16:05:16 +0100 From: Jonas Wielicki User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: python-list@python.org 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> In-Reply-To: <87k2z8dagc.fsf@elektro.pacujo.net> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Kf9m2twVRgR5ki19W9IIhTqC1sjPTHlcV" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424703937 news.xs4all.nl 2960 [2001:888:2000:d::a6]:48903 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86226 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Kf9m2twVRgR5ki19W9IIhTqC1sjPTHlcV Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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.= >=20 > Maybe. Then you'll probably have to rewrite smbus to work asyncio style= =2E > Those sleeps would then be done as "yield from" statements. >=20 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 libra= ry. regards, jwi [1]: https://docs.python.org/3/library/asyncio-dev.html#handle-blocking-functi= ons-correctly [2]: https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.BaseEven= tLoop.run_in_executor --Kf9m2twVRgR5ki19W9IIhTqC1sjPTHlcV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJU60G2AAoJEMBiAyWXYliK5FMQAI3M2tvizsauraGB8IkDddp4 NxFb+3QrzOxkNtKHG9vIa1FOId+lklXcSL+MZkJs/AMEHPC+H0IlY8sTBFZtFSUY xrhT0MzIvZRSurQaMjqrMU72S41j7Oh11/VltlfcObTuPV6TqmSpaEhlq55iEku3 7Ls8F35b4OlEwRn6+GI8R1kM+KAIiOKaWp/zYoYwIcRnx0Nf7A9K7v698M+zFRua Sl15BtVa6CrDQfK/Xv1fd4UnY1GBwgNtztcA7gqsIxOXI8yX5ArPC/Y1xgNCX/OG AOPxhJEh780njzf0JwNiRWE/pt/NqSpHl9/63fgo+vvymghKVujQtxpg/Y3Ax8Yq pXQ7/MVF9N5sI7OtNXkAhdafftIl230L24FF7XnYrSHE+3Xa49kbWjfoPfxKXPVp Yq2JStjXy74mN+//XbCD+qHZ0EHvz/7BGzX2NwgqYXY17foI1Ew5fkdapP3GLqzt AFPqAqeiurgbXx3CQN1Uoq44BQlfLzJY6ccfK4PbckKY524vD8IY9oYmSL8jtPhS HSBBRT88epEFDeiC0eoZBa/lwEl+6scTIN93gfqtGYh+PH+NVpdKbbXkMdDK36L0 5+r0OnSsVgZZed/D7sb9fNiVLBab9Bhz3lenFNY5bXBDePVAt4ieuxXWfDycvDCg BlFth+r/b3XPOOQFZRWs =qGOL -----END PGP SIGNATURE----- --Kf9m2twVRgR5ki19W9IIhTqC1sjPTHlcV--