Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python.announce > #2313
| From | Nathaniel Smith <njs@pobox.com> |
|---|---|
| Newsgroups | comp.lang.python.announce |
| Subject | [ANN] async_generator v1.2 released |
| Date | 2016-11-14 22:52 -0800 |
| Message-ID | <mailman.150.1479198206.30068.python-announce-list@python.org> (permalink) |
| References | <CAPJVwBmGz=SgWa_-T0N-RMbBeeC2ixO+3sKNh-faJcFUYH404Q@mail.gmail.com> |
Hi all,
I just released v1.2 of my async_generator package:
https://pypi.org/pypi/async_generator/
This package makes it easy to write PEP 525-style "async generators",
even on Python 3.5. It looks like:
from async_generator import async_generator, yield_, yield_from_
@async_generator
async def parse_json_separated_newlines_from_network(streamreader):
async for line in streamreader:
await yield_(json.loads(line))
Starting in v1.1 (released last week but not announced widely), the
generators are now highly compatible with 3.6's native async
generators, including full support for athrow / asend / aclose. They
also fully support "yield from", which is otherwise unavailable even
on Python 3.6.
v1.2 fixed some edge cases in "yield from" -- but the headline feature
is that we're now *so* compatible with 3.6's native async generators
that you can now use our yield from support directly inside a native
generator:
from async_generator import yield_from_
async def f():
yield 2
yield 3
# yields [1, 2, 3, 4]
async def g():
yield 1
await yield_from_(f())
yield 4
Have fun,
-n
--
Nathaniel J. Smith -- https://vorpus.org
Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread
[ANN] async_generator v1.2 released Nathaniel Smith <njs@pobox.com> - 2016-11-14 22:52 -0800
csiph-web