No project description provided
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
fntypes-0.1.4.post1.tar.gz
(5.7 kB
view details)
Built Distribution
File details
Details for the file fntypes-0.1.4.post1.tar.gz
.
File metadata
- Download URL: fntypes-0.1.4.post1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.9 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44805702e2b83870580a16fdcbb46491f9a7e2abc3f6dbd426f8d9dbe468170e |
|
MD5 | 7f3cf69a82fe7934187cbe67e3d652e6 |
|
BLAKE2b-256 | b676055be17fc572b85c1edd8487613080e2e88f9cda32931de77bfe1ef3d3d2 |
File details
Details for the file fntypes-0.1.4.post1-py3-none-any.whl
.
File metadata
- Download URL: fntypes-0.1.4.post1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.9 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dc33133f05322df59784d6d7dd41211d3dc5f1dd93c080e3ea60aa497279a6e |
|
MD5 | 9fd147943b20dbc600ca5441a86fa7eb |
|
BLAKE2b-256 | 68ebd3807d65311134f7b33198378539f139d0531a25de3986bb4079740668f3 |