Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: =?UTF-8?B?546L54+6?= Newsgroups: comp.lang.python Subject: Re: [Python-ideas] How the heck does async/await work in Python 3.5 Date: Wed, 24 Feb 2016 18:40:08 +0800 Lines: 55 Message-ID: References: <56c7d145$0$1597$c3e8da3$5496439d@news.astraweb.com> <56CCC98C.5060504@mail.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de +VIs/x2QsUTPldbppXKbFgOY+Xrn/ICfxdpy4ZuI4z0w== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'subject:: [': 0.03; 'subject:Python': 0.05; 'tries': 0.05; 'correct.': 0.07; 'url:msdn': 0.07; 'subject:How': 0.09; 'url:psf': 0.09; 'docs.': 0.09; 'python:': 0.09; 'thread': 0.10; 'python': 0.10; 'language,': 0.11; 'syntax': 0.13; 'discussions': 0.15; 'async': 0.16; 'concurrency': 0.16; 'insights': 0.16; 'only)': 0.16; 'programmers.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'seconds,': 0.16; 'subject:ideas': 0.16; 'wrote:': 0.16; 'basically': 0.18; 'subject:] ': 0.19; 'all,': 0.20; 'developer': 0.20; 'suggested': 0.20; 'meant': 0.22; 'suppose': 0.22; 'url:02': 0.22; 'appears': 0.23; 'fit': 0.23; 'seems': 0.23; 'finished': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'collecting': 0.27; 'actual': 0.28; 'device': 0.28; 'thread,': 0.29; 'print': 0.30; 'subject:/': 0.30; 'url:mailman': 0.30; 'code': 0.30; 'putting': 0.30; 'somebody': 0.30; 'operations': 0.31; 'seconds': 0.31; 'post': 0.31; 'another': 0.32; 'table': 0.32; 'older': 0.32; 'point': 0.33; 'url:python': 0.33; 'open': 0.33; 'similar': 0.33; 'url:listinfo': 0.34; 'list': 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'best,': 0.35; 'could': 0.35; 'done': 0.35; 'direction': 0.35; 'something': 0.35; 'sometimes': 0.35; 'but': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'possible': 0.36; '(and': 0.36; 'skip:_ 40': 0.36; 'email addr:python.org': 0.36; 'modules': 0.36; 'subject:work': 0.36; 'to:addr:python-list': 0.36; 'wanted': 0.37; 'received:209': 0.38; 'christian': 0.38; 'skip:p 20': 0.38; 'mailing': 0.38; 'subject:the': 0.39; 'takes': 0.39; 'subject:-': 0.39; 'url:mail': 0.40; 'well.': 0.40; 'to:addr:python.org': 0.40; 'some': 0.40; 'future': 0.60; 'valuable': 0.61; 'hope': 0.61; 'skip:u 10': 0.61; 'programs': 0.62; 'back': 0.62; 'here': 0.66; 'finally': 0.70; 'covers': 0.72; 'useful.': 0.72; 'overall': 0.72; 'interrupted': 0.76; 'concept,': 0.84; 'gollwitzer': 0.84; 'url:2016': 0.84; 'video:': 0.84; 'glad': 0.87; 'essence': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=kGYgOohOIBTpT/kbW4IV1XnYUYfJqFlp9IiYvd1xfs0=; b=QcH+fxxYA/RmubuxjAg2tNu9wr8FCdhsk57icuE0820DYH4BHzjOq6CtJ4kJKlwu71 IYR21+LdD1TTfQZZxN0rNo/tibjIaiyJdCIeGF/oKWQqTrmL3NhsgGqHVTO8B02aoZp/ PMgT71aZkmQQ9GcDUd3RSLwYb7IOSsSYUyYsGzgRy3Cifs+C8nz/3iN/ucbsrKLvuIij ChXpeOIN7VWk4677nPHJFVUERGftrE3WUo5C4q0o7kjEe8HE6d1hlUUtR1JKG8WkhN0Y knEZ6Xp3pKLhNLDugI3L5T1UiUwNxjB3QqcDB2/m98JkmtlN/QUt369FhyUZXkI1q8eD JJsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=kGYgOohOIBTpT/kbW4IV1XnYUYfJqFlp9IiYvd1xfs0=; b=BlgXN+e5PqSwpNzua6Xs9IX2hMhdaB+C+qoPhMQhI5eqEDsY6ZoEO/7p/+UNKGTrM3 jT56jn5vcmHplZ44zDSYNXts18hOYV60Z/+beJEKM2+20rvBHSrLyA4/gGBhPPruSMEa 0SZ98Yaxijm0E30XC1nNZTqKrxjxRy8ay8e+4ylg/UfNE3j39BaDX0ZSL2C91T2BgXaP 8HAFgyivH1FfiOKrT4QJ+imdampRtGZweMVKY9SBPrbjm7IA0zYef3kwvY9Z/N7CTVw4 dSrgHtu/xVz62ohUP/4Z/IN5rcL6jeEpWTqGhJcaZbtv7aOZEo/9CMJY0j9pBCqT7LV9 2M+w== X-Gm-Message-State: AG10YOSmj/2BIgRLvT9EbxSHRLk9gfzrGoNZ53t33qSTkm5aeYIVcPHi+v98T48f/mp4vAu1alE7uuKX54lqYA== X-Received: by 10.25.20.86 with SMTP id k83mr14719111lfi.12.1456310408827; Wed, 24 Feb 2016 02:40:08 -0800 (PST) In-Reply-To: <56CCC98C.5060504@mail.de> X-Mailman-Approved-At: Wed, 24 Feb 2016 05:42:12 -0500 X-Content-Filtered-By: Mailman/MimeDel 2.1.21rc2 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103440 It seems an event loop is required for all async programs in python, but sometimes I need only lazy i/o. Is it possible with asyncio? Suppose io_operation() takes 3 seconds, then how can I write something like future = io_operation() print('Start') time.sleep(1) print('Something') time.sleep(2) print(future.result()) that print 'Start' immediately and the result of io_operation() 3 seconds later. The actual io operations are done by the io device that the main (and only) thread is not interrupted at all, if my understanding is correct. 2016-02-24 5:05 GMT+08:00 Sven R. Kunze : > On 20.02.2016 07:53, Christian Gollwitzer wrote: > > If you have difficulties wit hthe overall concept, and if you are open to > discussions in another language, take a look at this video: > > > https://channel9.msdn.com/Shows/C9-GoingNative/GoingNative-39-await-co-routines > > MS has added coroutine support with very similar syntax to VC++ recently, > and the developer tries to explain it to the "stackful" programmers. > > > Because of this thread, I finally finished an older post collecting > valuable insights from last year discussions regarding concurrency modules > available in Python: > http://srkunze.blogspot.com/2016/02/concurrency-in-python.html It appears > to me that it would fit here well. > > @python-ideas > Back then, the old thread ("Concurrency Modules") was like basically meant > to result in something useful. I hope the post covers the essence of the > discussion. > Some even suggested putting the table into the Python docs. I am unaware > of the formal procedure here but I would be glad if somebody could point be > at the right direction if that the survey table is wanted in the docs. > > Best, > Sven > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >