Skip to main content

Rusts `Option` and `Result` in Python

Reason this release was yanked:

Incorrect description :(

Project description

oxypy

Tests

Fully-featured ports of several essential structs from Rust into pure Python

Since true privacy is impossible, inner values of the classes are


Methods

Some methods are deemed unnecessary due to the differences in the languages

Removed Methods:

  • Copy and clone methods
  • Ref and deref methods
  • Unchecked methods
  • Type-dependent methods

Reasons:

  • Methods relating to references are useless due to lack of them in Python.
  • Unchecked methods are unneccessary due to the lac of the unsafe system.
  • Type dependent methods are practically impossible due to the dynamic type system.

Examples

Note: Type annotations are not always necessary, but are done here for brevity

Option

from oxypy import Option

some: Option[int] = Option.some(10)
none: Option[int] = Option.none()

Result

ok: Result[int, str] = Result.ok(10)
err: Result[int, str] = Result.err("An error occured")

Either

from oxypy import Either

left: Either[int, float] = Either.left(42)
right: Either[int, float] = Either.right(3.14159265)

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

oxypy-1.0.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oxypy-1.0.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file oxypy-1.0.0.tar.gz.

File metadata

  • Download URL: oxypy-1.0.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.1

File hashes

Hashes for oxypy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 41496cf5207a25e8edabf091854bd1a98df88e0f595c059aa9ce96212baa2a0d
MD5 36e7dcfea4979bb46c18cc1f9b8e1cf4
BLAKE2b-256 1ef40b16cb5fa65031120cbd66f1d39053cc730203ae9b9f76c6795ae5871c07

See more details on using hashes here.

File details

Details for the file oxypy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: oxypy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.1

File hashes

Hashes for oxypy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 816e411d7c66ee6b9cfcfedf45c65113793f036923553e41328d0a3e037c3855
MD5 47a497c0cf37d4aacbb67fd4af22fa6a
BLAKE2b-256 afa6901b2c75411d73ed75bbc59c22ab703cbd56d1e797d67ef7d1fdd228185d

See more details on using hashes here.

Supported by

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