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.2.tar.gz (2.8 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.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: typing_result-0.1.2.tar.gz
  • Upload date:
  • Size: 2.8 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.2.tar.gz
Algorithm Hash digest
SHA256 9c2eb49a03c74a5c4b2019d6a580acf10ed449ad133e1acbd4714a6866d8c531
MD5 e08c5f82be13ba52ebee0ca636d7dab0
BLAKE2b-256 dc3879031661427c6f7b5bcb0ea7d5ba7a098de391733c37810545837bc5dc97

See more details on using hashes here.

File details

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

File metadata

  • Download URL: typing_result-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 593470194b092a1c3cf238a86cc02a77cd53f6770e28c8c42bb29b44e228f0be
MD5 89f929cbf2b558029a5dc2996a2124f5
BLAKE2b-256 6afe5e087a0203d1a985e2be081a906eaa637eb8b87353b9a7ba7647f686fb90

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