Skip to main content

A Result is the base class for several callable subclasses which will receive values at a later point in time, and can also be used standalone without subclassing.

A call to a Result will block until the value is received or the Result is cancelled, which will raise an exception in the caller. A Result may be called by multiple users, before or after the value has been delivered; if the value has been delivered the caller returns with it immediately. A Result’s state may be inspected (pending, running, ready, cancelled). Callbacks can be registered via an Asychron’s .notify method.

An incomplete Result can be told to call a function to compute its value; the function return will be stored as the value unless the function raises an exception, in which case the exception information is recorded instead. If an exception occurred, it will be reraised for any caller of the Result.

Trite example:

R = Result(name="my demo")

Thread 1:
  value = R()
  # blocks...
  print(value)
  # prints 3 once Thread 2 (below) assigns to it

Thread 2:
  R.result = 3

Thread 3:
  value = R()
  # returns immediately with 3

You can also collect multiple Results in completion order using the report() function:

Rs = [ ... list of Results or whatever type ... ]
...
for R in report(Rs):
  x = R()     # collect result, will return immediately
  print(x)    # print result

Metadata

Release files for cs-result 20171231

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

Source distribution (sdist)

Source distribution for cs-result 20171231
File Size Uploaded Provenance Actions
cs.result-20171231.tar.gz 5.8 kB Without provenance Details for cs.result-20171231.tar.gz

Release files / cs.result-20171231.tar.gz

Download URL cs.result-20171231.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
75e1eb8f47cf4de8439c6cb626963644348208133b871b264904047759f91b3c
BLAKE2b-256 checksum
How to use checksums
ffbb6aa5f415d427c4039d2c3901ae04152d4f24f387c0701fcb5fe958dc2773
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cs-result 20171231

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

20171231 This release

1 release file No provenance

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