Skip to main content

A python implementation of the Result type, based on the rust language

Project description

A python implementation of the Result type, based on the rust language

Installation

pip install typing-result

or

poetry install typing-result

Usage Example

def div(x: float, y: float) -> Result[float, ZeroDivisionError]:
	if y == 0:
		return Err(ZeroDivisionError("Ops"))

	return Ok(x / y)

result = div(10, 2)


match result:
	case Ok(v):
		print(v)

	case Err(e):
		# handle error here
		...

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

typing_result-0.1.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

typing_result-0.1.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file typing_result-0.1.1.tar.gz.

File metadata

  • Download URL: typing_result-0.1.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.10 Linux/6.2.11-arch1-1

File hashes

Hashes for typing_result-0.1.1.tar.gz
Algorithm Hash digest
SHA256 481742f0b1052035ae701c463e96e93bf17bf6022ac5a9ca721bb0509c95f764
MD5 663d32bb3e584d3e0011144b41d4d344
BLAKE2b-256 1aad06d442ba37be4687e781c413369e81f4bcf85f968b7d950cf79e01604884

See more details on using hashes here.

File details

Details for the file typing_result-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: typing_result-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.10 Linux/6.2.11-arch1-1

File hashes

Hashes for typing_result-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49ef824efa748abb5335a886203707f5176d9c0c383609434e7ae856f7bca2af
MD5 58f5afa521a299a66602ac3c31a21f02
BLAKE2b-256 189bf878ff4c8b333e7537a8bca52d3ef9c1a19a4171978276f3837c241ffe37

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