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 py-result

or

poetry install py-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.0.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.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: typing_result-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 e2429e3cf0112449fd5a7c8a866fadb3a058781365416132ffd1b17b8b4aabfb
MD5 92c19cefe87f7cf35c8c9ff31831d820
BLAKE2b-256 26b815599bc47815b67f13a7237f61fe3547346d26653db46975e578aa12b698

See more details on using hashes here.

File details

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

File metadata

  • Download URL: typing_result-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ccc6e4fc508357eb1ea7ee931ee37182b7e4a11bc3250eb7e998807f9cc16fe
MD5 65ae65e273290e0041169a6410f1632e
BLAKE2b-256 281fa932b84c22e8771bc2f23e60714dd5144e98559c7d80572970a88a26f994

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