FUNctional types for Python. (Backport to 0.2.1)
Project description
fntypes
Functional typing in Python!
See examples
See documentation
fntypes is based on the belief that raising exceptions should be avoided. Therefore, it offers a set of functional types needed to write better code. This type strategy grants your project with higher control over type system - improves control flow
Contributions are welcome
@unwrapping
def send_funds(
sender_id: int,
receiver_id: int,
amount: decimal.Decimal,
) -> Result[TransactionID, str]:
sender = get_user(sender_id).expect("Sender is undefined")
receiver = get_user(receiver_id).expect("Receiver is undefined")
if sender.get_balance().unwrap() < amount:
return Error("Sender has not enough funds to complete transaction")
return Ok(
create_transaction(sender, receiver, amount)
.unwrap()
.transaction_id
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file funtypes-0.2.1.tar.gz.
File metadata
- Download URL: funtypes-0.2.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1b35a355c52193c4dfd6a06b39cbbb07125be3d5331ebc0aac9c3d2b3e5c193
|
|
| MD5 |
78a0d1862c345bd364f3a207459039f7
|
|
| BLAKE2b-256 |
a259dc2bcf2bdacbd45b964bc8f588c87c8684f7d1828251eaaa46248b78bbc1
|
File details
Details for the file funtypes-0.2.1-py3-none-any.whl.
File metadata
- Download URL: funtypes-0.2.1-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
878129ec67117cad9719579897bd4cd7c35a332972bc226c860f7fc39336a658
|
|
| MD5 |
b2c370802cb179df2a4bd22e9f377f64
|
|
| BLAKE2b-256 |
10d42c623f3aa7336f7347d07c92a419eb9450fd517c9b20e7624637e5f7dc3b
|