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


Groups > comp.lang.python > #72439

Re: Benefits of asyncio

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'conversions': 0.09; 'explanation': 0.09; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'jan': 0.12; 'systems.': 0.12; 'windows': 0.15; 'btw': 0.16; 'deprecated.': 0.16; 'different,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'sequencing': 0.16; 'supplement': 0.16; 'switches': 0.16; 'tasks,': 0.16; 'tasks?': 0.16; 'thread,': 0.16; 'threads,': 0.16; 'twisted': 0.16; 'wrote:': 0.18; 'library': 0.18; 'looked': 0.18; 'thoughts': 0.19; 'example': 0.22; 'header:User-Agent:1': 0.23; 'example.': 0.24; 'lets': 0.24; 'question': 0.24; 'switch': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'external': 0.29; 'thus': 0.29; 'related': 0.29; 'code': 0.31; "skip:' 10": 0.31; 'fixing': 0.31; 'this.': 0.32; 'quite': 0.32; 'running': 0.33; 'core': 0.34; 'maybe': 0.34; 'could': 0.34; 'beyond': 0.35; 'but': 0.35; 'there': 0.35; 'version': 0.36; 'similar': 0.36; 'should': 0.36; 'area': 0.37; 'generic': 0.38; 'tasks': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; "couldn't": 0.39; 'itself': 0.39; 'received:71': 0.39; 'weight': 0.39; 'to:addr:python.org': 0.39; 'system.': 0.39; 'received:org': 0.40; 'major': 0.40; 'read': 0.60; 'advances': 0.60; 'simple': 0.61; 'such': 0.63; 'design,': 0.64; 'great': 0.65; 'due': 0.66; 'between': 0.67; 'believe': 0.68; 'answer.': 0.68; 'tasks.': 0.68; 'stated': 0.69; 'saw': 0.77; 'completion': 0.78; 'answer:': 0.84; 'asynchronous': 0.84; 'challenge.': 0.84; 'computation.': 0.84; 'light-weight': 0.84; 'lightweight': 0.84; 'received:fios.verizon.net': 0.84; 'reducing': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Benefits of asyncio
Date Mon, 02 Jun 2014 16:07:01 -0400
References <d1634744-39e8-4bfa-be76-1fd2292fd59f@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-71-175-90-87.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
In-Reply-To <d1634744-39e8-4bfa-be76-1fd2292fd59f@googlegroups.com>
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.10573.1401739639.18130.python-list@python.org> (permalink)
Lines 48
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1401739639 news.xs4all.nl 2851 [2001:888:2000:d::a6]:33623
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:72439

Show key headers only | View raw


On 6/2/2014 1:40 PM, Aseem Bansal wrote:

The following supplement Ian's answer.

> I read in these groups that asyncio is a great addition to Python 3.
> I have looked around and saw the related PEP which is quite big BTW
> but couldn't find a simple explanation for why this is such a great
> addition. Any simple example where it can be used?

asyncio replaces the very old asyncore, which has problems, is beyond 
fixing due to its design, and is now deprecated. So look up used for 
asyncore. You could think of asyncio as a lightweight version or core of 
other async packages, such as Twisted or Tornado. What are they good 
for. I admit that you should now have to answer the question so 
indirectly. One generic answer: carry on 'simultaneous' conversions with 
multiple external systems.

asyncio lets you write platform independent code while it makes good use 
of the asynchronous i/o available on each particular system. Async-i/o 
is one area where Windows has made advances over posix. But the models 
are different, and if one uses Windows' i/o completion as if it were 
posix poll/select, it works poorly. Running well on both types of 
systems was a major challenge.

> It can be used to have a queue of tasks?

Try set of tasks, as the sequencing may depend on external response times.

> Like threads? Maybe light weight threads?

Try light-weight thread, manages by Python instead of the OS.
I believe greenlets are a somewhat similar example.

> Those were my thoughts but the library reference
> clearly stated that this is single-threaded.

Meaning, asyncio itself only uses one os thread. The application, or 
individual tasks, can still spin off other os threads, perhaps for a 
long computation.

 > So there should be some waiting time in between the tasks.

I do not understand this. asyncio should switch between tasks faster 
than the OS switches between threads, thus reducing waiting time.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Benefits of asyncio Aseem Bansal <asmbansal2@gmail.com> - 2014-06-02 10:40 -0700
  Re: Benefits of asyncio Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-02 12:37 -0600
  Re: Benefits of asyncio Terry Reedy <tjreedy@udel.edu> - 2014-06-02 16:07 -0400
    Re: Benefits of asyncio Roy Smith <roy@panix.com> - 2014-06-02 16:19 -0400
    Re: Benefits of asyncio Marko Rauhamaa <marko@pacujo.net> - 2014-06-02 23:28 +0300
      Re: Benefits of asyncio Paul Rubin <no.email@nospam.invalid> - 2014-06-02 13:45 -0700
        Re: Benefits of asyncio Chris Angelico <rosuav@gmail.com> - 2014-06-03 07:49 +1000
        Re: Benefits of asyncio Terry Reedy <tjreedy@udel.edu> - 2014-06-02 21:51 -0400
        Re: Benefits of asyncio Marko Rauhamaa <marko@pacujo.net> - 2014-06-03 09:36 +0300
          Re: Benefits of asyncio Chris Angelico <rosuav@gmail.com> - 2014-06-03 18:47 +1000
            Re: Benefits of asyncio Marko Rauhamaa <marko@pacujo.net> - 2014-06-03 12:10 +0300
              Re: Benefits of asyncio Chris Angelico <rosuav@gmail.com> - 2014-06-03 19:30 +1000
                Re: Benefits of asyncio Marko Rauhamaa <marko@pacujo.net> - 2014-06-03 13:08 +0300
                Re: Benefits of asyncio Chris Angelico <rosuav@gmail.com> - 2014-06-03 20:23 +1000
                Re: Benefits of asyncio Marko Rauhamaa <marko@pacujo.net> - 2014-06-03 14:12 +0300
                Re: Benefits of asyncio Paul Rubin <no.email@nospam.invalid> - 2014-06-04 00:52 -0700
              Re: Benefits of asyncio Burak Arslan <burak.arslan@arskom.com.tr> - 2014-06-03 14:05 +0300
              Re: Benefits of asyncio Chris Angelico <rosuav@gmail.com> - 2014-06-03 21:57 +1000
              Re: Benefits of asyncio Burak Arslan <burak.arslan@arskom.com.tr> - 2014-06-04 08:10 +0300
              Re: Benefits of asyncio Chris Angelico <rosuav@gmail.com> - 2014-06-04 17:30 +1000
              Re: Benefits of asyncio Paul Rubin <no.email@nospam.invalid> - 2014-06-04 00:48 -0700
          Re: Benefits of asyncio "Frank Millman" <frank@chagford.com> - 2014-06-03 13:09 +0200
          Re: Benefits of asyncio Chris Angelico <rosuav@gmail.com> - 2014-06-03 22:01 +1000
            Re: Benefits of asyncio Marko Rauhamaa <marko@pacujo.net> - 2014-06-03 16:05 +0300
              Re: Benefits of asyncio Chris Angelico <rosuav@gmail.com> - 2014-06-03 23:31 +1000
                Re: Benefits of asyncio Marko Rauhamaa <marko@pacujo.net> - 2014-06-03 16:42 +0300
                Re: Benefits of asyncio Chris Angelico <rosuav@gmail.com> - 2014-06-03 23:49 +1000
                Re: Benefits of asyncio Marko Rauhamaa <marko@pacujo.net> - 2014-06-03 19:18 +0300
              Re: Benefits of asyncio Roy Smith <roy@panix.com> - 2014-06-03 11:40 -0400
        Re: Benefits of asyncio Paul Sokolovsky <pmiscml@gmail.com> - 2014-06-03 11:31 +0300
  Re: Benefits of asyncio Burak Arslan <burak.arslan@arskom.com.tr> - 2014-06-03 00:07 +0300
  Re: Benefits of asyncio Aseem Bansal <asmbansal2@gmail.com> - 2014-06-02 21:54 -0700

csiph-web