Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.033 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'subject:Question': 0.07; 'meantime,': 0.09; 'cc:addr:python-list': 0.11; 'executed.': 0.16; 'operation,': 0.16; 'seconds.': 0.16; 'subject:doc': 0.16; 'substitute': 0.16; 'code,': 0.22; 'example': 0.22; 'cc:addr:python.org': 0.22; 'example.': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'returned': 0.30; 'specified': 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'url:python': 0.33; "i'd": 0.34; 'received:google.com': 0.35; 'there': 0.35; 'i.e.': 0.36; 'yield': 0.36; 'url:listinfo': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'url:mail': 0.40; 'future': 0.60; 'completed': 0.61; 'url:3': 0.61; 'from:charset:utf-8': 0.61; 'real': 0.63; 'to:addr:gmail.com': 0.65; 'future,': 0.83 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 :cc:content-type; bh=Eub/GuqSJ0YAJGH9Fldm2aQsraR9Kg9lNn9i+/yya6Q=; b=SnoFHB6ApuaWvyyVx+lBauuWW6X03mFpg0dPHslsHD97UHhA2JCp1Kohd7VLifLXZ0 v3Kz/NceimWCYXTz9F2CU9zgfdS/2IGplu/730PdFDQLlVS2MtZZ8Hbv6dxJ7yoyCgKp yKz1TMUzzrkONQYthanOn4stjeJNF5h7FbV5qDpg6Gyh2ArFBHFMn/kgQCbev7awb3Mp gx+v8pqUhdxpqL80nIN22yGGCj2tS3JvRp69HNYKrTPIxqthyLYuI8cufQX4SObsNies w3sJTxnK+3IiadXxCM95BYVpI9vkheEh978mqu1x5LF/jiBn9jtPlGTJEZHK/jToqruU AFIw== MIME-Version: 1.0 X-Received: by 10.236.172.161 with SMTP id t21mr514718yhl.65.1406113121720; Wed, 23 Jul 2014 03:58:41 -0700 (PDT) In-Reply-To: References: Date: Wed, 23 Jul 2014 13:58:41 +0300 Subject: Re: Question about asyncio doc example From: =?UTF-8?B?WWHFn2FyIEFyYWJhY8Sx?= To: Saimadhav Heblikar Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406113124 news.xs4all.nl 2907 [2001:888:2000:d::a6]:42820 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75078 asyncio.sleep() returns you a Future. When you yield from a future, your coroutine blocks, until the Future completes. In the meantime, event loop continutes to execute other things that are waiting to be executed. The Future returned from asyncio.sleep gets completed after specified seconds. 2014-07-23 13:43 GMT+03:00 Saimadhav Heblikar : > Hi, > > The example in question is > https://docs.python.org/3/library/asyncio-task.html#example-hello-world-coroutine. > I'd like to learn the purpose of the statement > "yield from asyncio.sleep(2)" in that example. > > In particular, I'd like to know if asyncio.sleep() is used as a > substitute for slow/time consuming operation, i.e. in real code, > whether there will be a real time consuming statement in place of > asyncio.sleep(). > > -- > Regards > Saimadhav Heblikar > -- > https://mail.python.org/mailman/listinfo/python-list -- http://ysar.net/