Path: csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Cannot step through asynchronous iterator manually Date: Sat, 30 Jan 2016 01:02:29 -0700 Lines: 20 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 6xcptdVb4MHiqky8E7d25QgILvdrkdMLb8rh2fyTuzPw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'received:209.85.223': 0.03; 'higher-level': 0.09; 'loop.': 0.09; 'python': 0.10; 'jan': 0.11; '2016': 0.16; 'async': 0.16; 'iterator': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; '>': 0.18; 'pass': 0.22; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; "skip:' 10": 0.28; 'usually': 0.33; 'received:google.com': 0.35; 'expected': 0.35; 'step': 0.36; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'desired': 0.37; 'missing': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'course.': 0.67; "'for'": 0.84; 'construct': 0.84; 'to:name:python': 0.84 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=/VFqoHMFeMyPJo8ZFCCP0P6plx1/xPrfGurw4jCLBlM=; b=V0TpjEhGsydXM2OzVh3l54EHZokR3O0p3xy2IpWON1/QsKmIXcCAzxSse6Kfn/qVfY JhlYyzm30//ct7lKBrsdDeLZc+QQfbwj1X+fNAV7KnZkP8uiSaf0hPvHCIbVwZma/D7m 50s5syeHUHijMdAjzsogJM6+4mmiSEXm0j6PdyqdsEc8d8D1/UWVWNZHR95z21coxl1v edlDixbqANTmyTye/Zpd+geeBNempucx/EJ2yGfyMXwoX+e/cuUF2qZb/tyvMZveS7eD t+iubZ0jn2qoUCGVObFJ0eckBxFXgHtXYvTeH/fq6MbUGP45Mabd2Enp5hoidnpgQCU+ O+XQ== 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=/VFqoHMFeMyPJo8ZFCCP0P6plx1/xPrfGurw4jCLBlM=; b=SMbBUW5WEV7pN9mNIqDfpCpfF6/pVbCL9jes4Vz27UQRxDe3ObnN9MwbZlIwQXLYu9 uGbUABWLy3chcFZkKBmJXKCZB5sXTC7/OUVNC27JVuwE1nTX8d9rcpPWoj1vd0EWlkR5 930B8CAI5l7yZ9zd2dH2TXq04iZnDkvyRUuj45rnLWni60+VY8ZJ1ZKt8ianXVzfHfAn 2ZcdrpkiEESckPVkttBYbfgfXkQ3Z4PD6gwtfMQSWvxtPzttwF2ieJYwH9ONof5bBk7b HantIDxFGDsgNJPBvy3sVa8YzS0lE9ZUqHpSQ/fWME07bOasZXEmqF0Kmmck2NiTMJao sXRg== X-Gm-Message-State: AG10YORvSDwtvigSDMW6+vwbW/72snQCP3Htjmx2LLUPdwgzEZHQdZOwY03Y/cZgeCLm139UDLQVAw0MTUef/A== X-Received: by 10.107.19.90 with SMTP id b87mr1797392ioj.11.1454140949750; Sat, 30 Jan 2016 00:02:29 -0800 (PST) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.20+ X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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:102284 On Jan 29, 2016 11:04 PM, "Frank Millman" wrote: > > Hi all > > To loop though an iterator one usually uses a higher-level construct such as a 'for' loop. However, if you want to step through it manually you can do so with next(iter). > > I expected the same functionality with the new 'asynchronous iterator' in Python 3.5, but I cannot find it. > > I can achieve the desired result by calling 'await aiter.__anext__()', but this is clunky. > > Am I missing something? async for x in aiter: pass Can only be used inside a coroutine, of course.