Skip to main content

A set of utility functions for coroutines.

Project description

build status

A set of utility functions for coroutines.

Example

In this example we will be showing comap. comap is like __builtins__.map; however, it knows about the coroutine protocol (send, throw, and close). Here we will show how you can map over a coroutine while still being able to send into it.

>>> def my_coroutine():
...     yield (yield (yield 1))
>>> from cotoolz import comap
>>> cm = comap(lambda a: a + 1, my_coroutine())
>>> next(cm)
2
>>> cm.send(2)
3
>>> cm.send(3)
4
>>> cm.send(4)
Traceback (most recent call last):
    ...
StopIteration

Dependencies

cotoolz depends on CPython 3 and some means of compiling C99. We recommend using gcc to compile cotoolz.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cotoolz-0.1.5.tar.gz (18.5 kB view details)

Uploaded Source

File details

Details for the file cotoolz-0.1.5.tar.gz.

File metadata

  • Download URL: cotoolz-0.1.5.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cotoolz-0.1.5.tar.gz
Algorithm Hash digest
SHA256 e38661d03f225e0d9074eaba81c6b51811ff69a65aa51a3f3169969a618331e2
MD5 65cc3c2aa67d26774109bb6a4b0a67b2
BLAKE2b-256 c508cf0cd2c2de713502e3a01b54aa75a9e4f7dd858e57fe451d5f19eab95ecf

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page