Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102306
| Path | csiph.com!news.mixmin.net!news.albasani.net!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Cannot step through asynchronous iterator manually |
| Date | Sat, 30 Jan 2016 09:42:54 -0700 |
| Lines | 25 |
| Message-ID | <mailman.132.1454172216.2338.python-list@python.org> (permalink) |
| References | <n8hjmt$b8n$1@ger.gmane.org> <CALwzid=sSDSm8hdAN+ORJ54A_jEu9Wc8103iqGKAah8mrj-TXw@mail.gmail.com> <n8hrs1$orn$1@ger.gmane.org> <CAHVvXxSA0Yq4VOYy6qycgXxVpL5zZGM8muUi+1VmeZD8CRgtvg@mail.gmail.com> <n8ieqk$a05$1@ger.gmane.org> <CAHVvXxST-inCFVnTGhUXpAAUc_xKfrwHKbqzSJka1O4rqB2YHA@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de 51yuFA2iKVquyIeGNO9kuQuKsqTf+sjkXLv0o2mJ3xqw== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'rows': 0.09; 'jan': 0.11; 'syntax': 0.13; 'def': 0.13; 'appropriate': 0.14; '2016': 0.16; 'async': 0.16; 'iterator': 0.16; 'itertools': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; '\xc2\xa0if': 0.16; 'wrote:': 0.16; '>': 0.18; 'email addr:gmail.com>': 0.18; 'versions': 0.20; 'am,': 0.23; 'third-party': 0.23; "haven't": 0.24; 'header:In- Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'module.': 0.27; 'pep': 0.29; 'class': 0.33; 'received:google.com': 0.35; 'done': 0.35; 'item': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'wanted': 0.37; 'received:209': 0.38; 'anything': 0.38; 'end': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.40; 'provide': 0.61; 'further': 0.62; '30,': 0.63; 'await': 0.76; '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:from:date:message-id:subject:to :content-type; bh=gXzEqgdddBO/zSptHY4c93MRb3QpAIsPyZGLUHIwK1c=; b=DpmFFzbFeIYt4oMflKwsTThGqbEVZ7EEUM4ePfRAvlT7CkAmZsS/+ZTZiAPJmjR8JX XMEqfUWLs8AerA0H6fYhLPRaVu9IBg8l5gssDOqME0sq6ENscEVLfSm4lH0o3bGRp+h/ B9nD1bNhdAxYhjZx10rh27FKYIRVpUsXx8q2Adf40KBacbebhiDEnPfh2mtNdx3nnVny 30F9d6+4jlpZCUyxi5q34xBhDps8/WjBGb6dFoRC/CZVN+nbl06hRyYvrsq1QqW3ovXJ 1ZGNBV8J5sXC+V0bN85/S+Cfh0n8Hk4oVNcNEVSjUvjb2oTRPmWSyFBuMuVtcO93r5SP ulnw== |
| 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:from:date :message-id:subject:to:content-type; bh=gXzEqgdddBO/zSptHY4c93MRb3QpAIsPyZGLUHIwK1c=; b=c8MEpu7gANnzVpaxIvMDFb/EBC92j5T61iRPwryuZSywfkdLwjtbSOysfyXLAv23bi 3vhHMQMnYdGdLpqgBtY1uUQHlJEcQVpwP53RGrYzJss/6uCsDkpKkUQ28QAmQ6cHT+0J cnY9pZUS6O/uKPmHCxSp4ssKRT3or6sVgBGftatwOk4SpvVSxmDlxtdiaqqelFEkx1kK f/0+P306aHpHVTEyn2f0Ko66lzgZNz2Q0BiWnoqiMbBI8oSIKfNGrHSU0v97OIHFAuUU 49dDAsgroGiKYobH0EOXk0s0XvLzSSdsJDanWDD+5el3erdDETzWlY3CLQ1Y7/mkQXrg tFXA== |
| X-Gm-Message-State | AG10YOT2WxS8OOJFTiEXgEwiNU9/eV7vsHQDFsJdth7mKW9gkFSaB2UtomwCgcLzWcv5WXOg3tdB2Cn4bKlkfg== |
| X-Received | by 10.50.131.201 with SMTP id oo9mr2890011igb.68.1454172213719; Sat, 30 Jan 2016 08:43:33 -0800 (PST) |
| In-Reply-To | <CAHVvXxST-inCFVnTGhUXpAAUc_xKfrwHKbqzSJka1O4rqB2YHA@mail.gmail.com> |
| 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 <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> |
| Xref | csiph.com comp.lang.python:102306 |
Show key headers only | View raw
On Jan 30, 2016 7:13 AM, "Oscar Benjamin" <oscar.j.benjamin@gmail.com> wrote: > > I haven't used PEP 492 yet but what about: > > async def aslice(asynciterator, end): > if end == 0: > return [] > items = [] > async for item in asynciterator: > items.append(item) > if len(items) == end: > break > return items > > rows = await aslice(cur, 2) > > AFAICT there's no generator-function-style syntax for writing an async > iterator so you'd have to make a class with the appropriate methods if > you wanted to be able to loop over aslice with async for. Before you go any further with this, be sure to check out the aitertools third-party module. I haven't done anything with it myself, but it already claims to provide aiter and anext as well as async versions of everything in the standard itertools module.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Cannot step through asynchronous iterator manually Ian Kelly <ian.g.kelly@gmail.com> - 2016-01-30 09:42 -0700
csiph-web