Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #86226

Re: Question on asyncio

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 <jonas@wielicki.name>
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 <jonas@wielicki.name>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.19074.1424703937.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


[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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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