Skip to main content

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.

Release files for cotoolz 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cotoolz 0.1.6
File Size Uploaded
cotoolz-0.1.6.tar.gz 19.1 kB Details

Release files / cotoolz-0.1.6.tar.gz

Download URL cotoolz-0.1.6.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e6b444081f5c4a35f28ddf205882c2349fce899317b0ae8ecb608caf90233bb8
BLAKE2b-256 checksum
How to use checksums
a8e6988d879989c8f0c0e65e620236ff237c13a3f416b69d77fd7ce386702bf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.6 This release

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page